Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhatha committed Aug 6, 2024
1 parent 5c9aac9 commit 96b9772
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ public void setInitialCapacity(int numRecords) {
*
* @param numRecords value count
* @param density density of LargeListViewVector. Density is the average size of a list per
* position in the ListViewVector. For example, a density value of 10 implies each position in
* the list vector has a list of 10 values. A density value of 0.1 implies out of 10 positions
* in the list vector, 1 position has a list of size 1, and the remaining positions are null
* (no lists) or empty lists. This helps in tightly controlling the memory we provision for
* inner data vector.
* position in the LargeListViewVector. For example, a density value of 10 implies each
* position in the list vector has a list of 10 values. A density value of 0.1 implies out of
* 10 positions in the list vector, 1 position has a list of size 1, and the remaining
* positions are null (no lists) or empty lists. This helps in tightly controlling the memory
* we provision for inner data vector.
*/
@Override
public void setInitialCapacity(int numRecords, double density) {
Expand Down Expand Up @@ -362,19 +362,19 @@ public TransferPair getTransferPair(Field field, BufferAllocator allocator) {
@Override
public TransferPair getTransferPair(String ref, BufferAllocator allocator, CallBack callBack) {
throw new UnsupportedOperationException(
"LargeListVector does not support getTransferPair(String, BufferAllocator, CallBack) yet");
"LargeListViewVector does not support getTransferPair(String, BufferAllocator, CallBack) yet");
}

@Override
public TransferPair getTransferPair(Field field, BufferAllocator allocator, CallBack callBack) {
throw new UnsupportedOperationException(
"LargeListVector does not support getTransferPair(Field, BufferAllocator, CallBack) yet");
"LargeListViewVector does not support getTransferPair(Field, BufferAllocator, CallBack) yet");
}

@Override
public TransferPair makeTransferPair(ValueVector target) {
throw new UnsupportedOperationException(
"LargeListVector does not support makeTransferPair(ValueVector) yet");
"LargeListViewVector does not support makeTransferPair(ValueVector) yet");
}

@Override
Expand Down Expand Up @@ -798,7 +798,7 @@ public void setValueCount(int valueCount) {
*/
Preconditions.checkArgument(
childValueCount <= Integer.MAX_VALUE || childValueCount >= Integer.MIN_VALUE,
"LargeListVector doesn't yet support 64-bit allocations: %s",
"LargeListViewVector doesn't yet support 64-bit allocations: %s",
childValueCount);
vector.setValueCount((int) childValueCount);
}
Expand Down Expand Up @@ -841,7 +841,7 @@ public int getValueCount() {
}

/**
* Get the density of this ListVector.
* Get the density of this LargeListViewVector.
*
* @return density
*/
Expand All @@ -853,7 +853,7 @@ public double getDensity() {
return totalListSize / valueCount;
}

/** Validating ListViewVector creation based on the specification guideline. */
/** Validating LargeListViewVector creation based on the specification guideline. */
@Override
public void validate() {
for (int i = 0; i < valueCount; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.arrow.vector.complex.impl;

import static org.apache.arrow.memory.util.LargeMemoryUtil.checkedCastToInt;

import org.apache.arrow.vector.ValueVector;
import org.apache.arrow.vector.complex.BaseLargeRepeatedValueViewVector;
import org.apache.arrow.vector.complex.LargeListViewVector;
Expand All @@ -33,7 +35,7 @@ public class UnionLargeListViewReader extends AbstractFieldReader {
private int size;

/**
* Constructor for UnionListViewReader.
* Constructor for UnionLargeListViewReader.
*
* @param vector the vector to read from
*/
Expand Down Expand Up @@ -105,7 +107,7 @@ public boolean next() {
// And, size keeps track of the elements count in the list, so to make sure we traverse
// the full list, we need to check if the currentOffset is less than the currentOffset + size
if (currentOffset < currentOffset + size) {
data.getReader().setPosition(currentOffset++);
data.getReader().setPosition(checkedCastToInt(currentOffset++));
return true;
} else {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
import org.apache.arrow.vector.complex.impl.UInt2WriterImpl;
import org.apache.arrow.vector.complex.impl.UInt4WriterImpl;
import org.apache.arrow.vector.complex.impl.UInt8WriterImpl;
import org.apache.arrow.vector.complex.impl.UnionLargeListViewWriter;
import org.apache.arrow.vector.complex.impl.UnionLargeListWriter;
import org.apache.arrow.vector.complex.impl.UnionListWriter;
import org.apache.arrow.vector.complex.impl.UnionWriter;
Expand Down Expand Up @@ -657,7 +658,7 @@ public FieldVector getNewVector(

@Override
public FieldWriter getNewFieldWriter(ValueVector vector) {
return new UnionLargeListWriter((LargeListVector) vector);
return new UnionLargeListViewWriter((LargeListViewVector) vector);
}
},
FIXED_SIZE_LIST(null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
import org.apache.arrow.memory.ArrowBuf;
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.vector.complex.BaseLargeRepeatedValueViewVector;
import org.apache.arrow.vector.complex.LargeListVector;
import org.apache.arrow.vector.complex.LargeListViewVector;
import org.apache.arrow.vector.complex.ListViewVector;
import org.apache.arrow.vector.complex.impl.UnionLargeListViewWriter;
import org.apache.arrow.vector.types.Types.MinorType;
import org.apache.arrow.vector.types.pojo.ArrowType;
Expand Down Expand Up @@ -287,7 +285,7 @@ public void testNestedLargeListViewVector() throws Exception {

assertEquals(2, largeListViewVector.getValueCount());

/* get listVector value at index 0 -- the value itself is a listvector */
/* get largeListViewVector value at index 0 -- the value itself is a largeListViewVector */
Object result = largeListViewVector.getObject(0);
ArrayList<ArrayList<Long>> resultSet = (ArrayList<ArrayList<Long>>) result;
ArrayList<Long> list;
Expand All @@ -307,7 +305,7 @@ public void testNestedLargeListViewVector() throws Exception {
assertEquals(Long.valueOf(150), list.get(2));
assertEquals(Long.valueOf(175), list.get(3));

/* get listVector value at index 1 -- the value itself is a listvector */
/* get largeListViewVector value at index 1 -- the value itself is a largeListViewVector */
result = largeListViewVector.getObject(1);
resultSet = (ArrayList<ArrayList<Long>>) result;

Expand Down Expand Up @@ -335,7 +333,7 @@ public void testNestedLargeListViewVector() throws Exception {
/* check underlying offsets */
final ArrowBuf offsetBuffer = largeListViewVector.getOffsetBuffer();

/* listVector has 2 lists at index 0 and 3 lists at index 1 */
/* largeListViewVector has 2 lists at index 0 and 3 lists at index 1 */
assertEquals(0, offsetBuffer.getLong(0 * LargeListViewVector.OFFSET_WIDTH));
assertEquals(2, offsetBuffer.getLong(1 * LargeListViewVector.OFFSET_WIDTH));
}
Expand All @@ -346,27 +344,27 @@ public void testNestedLargeListViewVector1() {
try (LargeListViewVector largeListViewVector =
LargeListViewVector.empty("sourceVector", allocator)) {

MinorType listViewType = MinorType.LISTVIEW;
MinorType listViewType = MinorType.LARGELISTVIEW;
MinorType scalarType = MinorType.BIGINT;

largeListViewVector.addOrGetVector(FieldType.nullable(listViewType.getType()));

ListViewVector innerList1 = (ListViewVector) largeListViewVector.getDataVector();
LargeListViewVector innerList1 = (LargeListViewVector) largeListViewVector.getDataVector();
innerList1.addOrGetVector(FieldType.nullable(listViewType.getType()));

ListViewVector innerList2 = (ListViewVector) innerList1.getDataVector();
LargeListViewVector innerList2 = (LargeListViewVector) innerList1.getDataVector();
innerList2.addOrGetVector(FieldType.nullable(listViewType.getType()));

ListViewVector innerList3 = (ListViewVector) innerList2.getDataVector();
LargeListViewVector innerList3 = (LargeListViewVector) innerList2.getDataVector();
innerList3.addOrGetVector(FieldType.nullable(listViewType.getType()));

ListViewVector innerList4 = (ListViewVector) innerList3.getDataVector();
LargeListViewVector innerList4 = (LargeListViewVector) innerList3.getDataVector();
innerList4.addOrGetVector(FieldType.nullable(listViewType.getType()));

ListViewVector innerList5 = (ListViewVector) innerList4.getDataVector();
LargeListViewVector innerList5 = (LargeListViewVector) innerList4.getDataVector();
innerList5.addOrGetVector(FieldType.nullable(listViewType.getType()));

ListViewVector innerList6 = (ListViewVector) innerList5.getDataVector();
LargeListViewVector innerList6 = (LargeListViewVector) innerList5.getDataVector();
innerList6.addOrGetVector(FieldType.nullable(scalarType.getType()));

largeListViewVector.setInitialCapacity(128);
Expand Down Expand Up @@ -420,7 +418,7 @@ public void testNestedLargeListViewVector2() throws Exception {

assertEquals(2, largeListViewVector.getValueCount());

/* get listVector value at index 0 -- the value itself is a listvector */
/* get largeListViewVector value at index 0 -- the value itself is a largeListViewVector */
Object result = largeListViewVector.getObject(0);
ArrayList<ArrayList<Long>> resultSet = (ArrayList<ArrayList<Long>>) result;
ArrayList<Long> list;
Expand All @@ -438,7 +436,7 @@ public void testNestedLargeListViewVector2() throws Exception {
assertEquals(Long.valueOf(75), list.get(0));
assertEquals(Long.valueOf(125), list.get(1));

/* get listVector value at index 1 -- the value itself is a listvector */
/* get largeListViewVector value at index 1 -- the value itself is a largeListViewVector */
result = largeListViewVector.getObject(1);
resultSet = (ArrayList<ArrayList<Long>>) result;

Expand All @@ -462,7 +460,7 @@ public void testNestedLargeListViewVector2() throws Exception {
/* check underlying offsets */
final ArrowBuf offsetBuffer = largeListViewVector.getOffsetBuffer();

/* listVector has 2 lists at index 0 and 3 lists at index 1 */
/* largeListViewVector has 2 lists at index 0 and 3 lists at index 1 */
assertEquals(0, offsetBuffer.getLong(0 * LargeListViewVector.OFFSET_WIDTH));
assertEquals(2, offsetBuffer.getLong(1 * LargeListViewVector.OFFSET_WIDTH));
}
Expand Down Expand Up @@ -492,7 +490,7 @@ public void testGetBufferAddress() throws Exception {

largeListViewVector.setValueCount(2);

/* check listVector contents */
/* check largeListViewVector contents */
Object result = largeListViewVector.getObject(0);
ArrayList<Long> resultSet = (ArrayList<Long>) result;
assertEquals(3, resultSet.size());
Expand Down Expand Up @@ -532,7 +530,7 @@ public void testGetBufferAddress() throws Exception {

/*
* Setting up the buffers directly needs to be validated with the base method used in
* the ListVector class where we use the approach of startListView(),
* the LargeListViewVector class where we use the approach of startListView(),
* write to the child vector and endListView().
* <p>
* To support this, we have to consider the following scenarios;
Expand All @@ -543,7 +541,7 @@ public void testGetBufferAddress() throws Exception {
*/

/* Setting up buffers directly would require the following steps to be taken
* 0. Allocate buffers in listViewVector by calling `allocateNew` method.
* 0. Allocate buffers in largeListViewVector by calling `allocateNew` method.
* 1. Initialize the child vector using `initializeChildrenFromFields` method.
* 2. Set values in the child vector.
* 3. Set validity, offset and size buffers using `setValidity`,
Expand Down Expand Up @@ -719,7 +717,7 @@ public void testBasicLargeListViewSetNested() {

assertEquals(2, largeListViewVector.getValueCount());

/* get listViewVector value at index 0 -- the value itself is a listViewVector */
/* get largeListViewVector value at index 0 -- the value itself is a largeListViewVector */
Object result = largeListViewVector.getObject(0);
ArrayList<ArrayList<Long>> resultSet = (ArrayList<ArrayList<Long>>) result;
ArrayList<Long> list;
Expand All @@ -739,7 +737,7 @@ public void testBasicLargeListViewSetNested() {
assertEquals(Long.valueOf(150), list.get(2));
assertEquals(Long.valueOf(175), list.get(3));

/* get listViewVector value at index 1 -- the value itself is a listViewVector */
/* get largeListViewVector value at index 1 -- the value itself is a largeListViewVector */
result = largeListViewVector.getObject(1);
resultSet = (ArrayList<ArrayList<Long>>) result;

Expand Down Expand Up @@ -900,11 +898,11 @@ public void testConsistentChildName() throws Exception {
try (LargeListViewVector largeListViewVector =
LargeListViewVector.empty("sourceVector", allocator)) {
String emptyListStr = largeListViewVector.getField().toString();
assertTrue(emptyListStr.contains(LargeListVector.DATA_VECTOR_NAME));
assertTrue(emptyListStr.contains(LargeListViewVector.DATA_VECTOR_NAME));

largeListViewVector.addOrGetVector(FieldType.nullable(MinorType.INT.getType()));
String emptyVectorStr = largeListViewVector.getField().toString();
assertTrue(emptyVectorStr.contains(LargeListVector.DATA_VECTOR_NAME));
assertTrue(emptyVectorStr.contains(LargeListViewVector.DATA_VECTOR_NAME));
}
}

Expand Down Expand Up @@ -1105,7 +1103,7 @@ public void testIsEmpty() {
public void testTotalCapacity() {
final FieldType type = FieldType.nullable(MinorType.INT.getType());
try (final LargeListViewVector vector =
new LargeListViewVector("largelist", allocator, type, null)) {
new LargeListViewVector("largelistview", allocator, type, null)) {
// Force the child vector to be allocated based on the type
// (this is a bad API: we have to track and repeat the type twice)
vector.addOrGetVector(type);
Expand Down

0 comments on commit 96b9772

Please sign in to comment.