Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public ValueVector visit(BaseFixedWidthVector deltaVector, Void value) {
Preconditions.checkArgument(targetVector.getField().getType().equals(deltaVector.getField().getType()),
"The targetVector to append must have the same type as the targetVector being appended");

if (deltaVector.getValueCount() == 0) {
return targetVector; // optimization, nothing to append, return
}

int newValueCount = targetVector.getValueCount() + deltaVector.getValueCount();

// make sure there is enough capacity
Expand All @@ -90,6 +94,10 @@ public ValueVector visit(BaseVariableWidthVector deltaVector, Void value) {
Preconditions.checkArgument(targetVector.getField().getType().equals(deltaVector.getField().getType()),
"The targetVector to append must have the same type as the targetVector being appended");

if (deltaVector.getValueCount() == 0) {
return targetVector; // nothing to append, return
}

int newValueCount = targetVector.getValueCount() + deltaVector.getValueCount();

int targetDataSize = targetVector.getOffsetBuffer().getInt(
Expand Down Expand Up @@ -140,6 +148,10 @@ public ValueVector visit(BaseLargeVariableWidthVector deltaVector, Void value) {
Preconditions.checkArgument(targetVector.getField().getType().equals(deltaVector.getField().getType()),
"The targetVector to append must have the same type as the targetVector being appended");

if (deltaVector.getValueCount() == 0) {
return targetVector; // nothing to append, return
}

int newValueCount = targetVector.getValueCount() + deltaVector.getValueCount();

long targetDataSize = targetVector.getOffsetBuffer().getLong(
Expand Down Expand Up @@ -190,6 +202,10 @@ public ValueVector visit(ListVector deltaVector, Void value) {
Preconditions.checkArgument(typeVisitor.equals(deltaVector),
"The targetVector to append must have the same type as the targetVector being appended");

if (deltaVector.getValueCount() == 0) {
return targetVector; // nothing to append, return
}

int newValueCount = targetVector.getValueCount() + deltaVector.getValueCount();

int targetListSize = targetVector.getOffsetBuffer().getInt(
Expand Down Expand Up @@ -241,6 +257,10 @@ public ValueVector visit(LargeListVector deltaVector, Void value) {
Preconditions.checkArgument(typeVisitor.equals(deltaVector),
"The targetVector to append must have the same type as the targetVector being appended");

if (deltaVector.getValueCount() == 0) {
return targetVector; // nothing to append, return
}

int newValueCount = targetVector.getValueCount() + deltaVector.getValueCount();

long targetListSize = targetVector.getOffsetBuffer().getLong(
Expand Down Expand Up @@ -293,6 +313,10 @@ public ValueVector visit(FixedSizeListVector deltaVector, Void value) {
Preconditions.checkArgument(typeVisitor.equals(deltaVector),
"The vector to append must have the same type as the targetVector being appended");

if (deltaVector.getValueCount() == 0) {
return targetVector; // optimization, nothing to append, return
}

FixedSizeListVector targetListVector = (FixedSizeListVector) targetVector;

Preconditions.checkArgument(targetListVector.getListSize() == deltaVector.getListSize(),
Expand Down Expand Up @@ -330,6 +354,10 @@ public ValueVector visit(NonNullableStructVector deltaVector, Void value) {
Preconditions.checkArgument(typeVisitor.equals(deltaVector),
"The vector to append must have the same type as the targetVector being appended");

if (deltaVector.getValueCount() == 0) {
return targetVector; // optimization, nothing to append, return
}

NonNullableStructVector targetStructVector = (NonNullableStructVector) targetVector;
int newValueCount = targetVector.getValueCount() + deltaVector.getValueCount();

Expand Down Expand Up @@ -365,6 +393,10 @@ public ValueVector visit(UnionVector deltaVector, Void value) {
Preconditions.checkArgument(targetVector.getMinorType() == deltaVector.getMinorType(),
"The vector to append must have the same type as the targetVector being appended");

if (deltaVector.getValueCount() == 0) {
return targetVector; // optimization, nothing to append, return
}

UnionVector targetUnionVector = (UnionVector) targetVector;
int newValueCount = targetVector.getValueCount() + deltaVector.getValueCount();

Expand Down Expand Up @@ -424,6 +456,10 @@ public ValueVector visit(DenseUnionVector deltaVector, Void value) {
Preconditions.checkArgument(targetVector.getMinorType() == deltaVector.getMinorType(),
"The vector to append must have the same type as the targetVector being appended");

if (deltaVector.getValueCount() == 0) {
return targetVector; // optimization, nothing to append, return
}

DenseUnionVector targetDenseUnionVector = (DenseUnionVector) targetVector;
int newValueCount = targetVector.getValueCount() + deltaVector.getValueCount();

Expand Down
Loading