Skip to content

Commit b942794

Browse files
committed
use ArrowType for equal
1 parent 1d95c9c commit b942794

File tree

7 files changed

+6
-38
lines changed

7 files changed

+6
-38
lines changed

java/vector/src/main/codegen/templates/UnionVector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ public boolean equals(int index, ValueVector to, int toIndex) {
665665
if (to == null) {
666666
return false;
667667
}
668-
if (this.getMinorType() != to.getMinorType()) {
668+
if (!this.getField().getType().equals(to.getField().getType())) {
669669
return false;
670670
}
671671
UnionVector that = (UnionVector) to;

java/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ public boolean equals(int index, ValueVector to, int toIndex) {
870870
if (to == null) {
871871
return false;
872872
}
873-
if (this.getMinorType() != to.getMinorType()) {
873+
if (!this.getField().getType().equals(to.getField().getType())) {
874874
return false;
875875
}
876876

java/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ public boolean equals(int index, ValueVector to, int toIndex) {
13691369
if (to == null) {
13701370
return false;
13711371
}
1372-
if (this.getMinorType() != to.getMinorType()) {
1372+
if (!this.getField().getType().equals(to.getField().getType())) {
13731373
return false;
13741374
}
13751375

java/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.math.BigDecimal;
2323

2424
import org.apache.arrow.memory.BufferAllocator;
25-
import org.apache.arrow.memory.util.ByteFunctionHelpers;
2625
import org.apache.arrow.vector.complex.impl.DecimalReaderImpl;
2726
import org.apache.arrow.vector.complex.reader.FieldReader;
2827
import org.apache.arrow.vector.holders.DecimalHolder;
@@ -490,37 +489,6 @@ public void setSafe(int index, int isSet, int start, ArrowBuf buffer) {
490489
set(index, isSet, start, buffer);
491490
}
492491

493-
@Override
494-
public boolean equals(int index, ValueVector to, int toIndex) {
495-
if (to == null) {
496-
return false;
497-
}
498-
if (this.getMinorType() != to.getMinorType()) {
499-
return false;
500-
}
501-
502-
DecimalVector that = (DecimalVector) to;
503-
504-
if (this.scale != that.scale || this.precision != that.precision) {
505-
return false;
506-
}
507-
508-
if (this.isSet(index) != that.isSet(toIndex)) {
509-
return false;
510-
}
511-
512-
int leftStart = TYPE_WIDTH * index;
513-
int leftEnd = TYPE_WIDTH * (index + 1);
514-
515-
int rightStart = TYPE_WIDTH * toIndex;
516-
int rightEnd = TYPE_WIDTH * (toIndex + 1);
517-
518-
int ret = ByteFunctionHelpers.equal(this.getDataBuffer(), leftStart, leftEnd,
519-
that.getDataBuffer(), rightStart, rightEnd);
520-
return ret == 1;
521-
}
522-
523-
524492
/*----------------------------------------------------------------*
525493
| |
526494
| vector transfer |

java/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ public boolean equals(int index, ValueVector to, int toIndex) {
520520
if (to == null) {
521521
return false;
522522
}
523-
if (this.getMinorType() != to.getMinorType()) {
523+
if (!this.getField().getType().equals(to.getField().getType())) {
524524
return false;
525525
}
526526

java/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ public boolean equals(int index, ValueVector to, int toIndex) {
430430
if (to == null) {
431431
return false;
432432
}
433-
if (this.getMinorType() != to.getMinorType()) {
433+
if (!this.getField().getType().equals(to.getField().getType())) {
434434
return false;
435435
}
436436

java/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ public boolean equals(int index, ValueVector to, int toIndex) {
303303
if (to == null) {
304304
return false;
305305
}
306-
if (this.getMinorType() != to.getMinorType()) {
306+
if (!this.getField().getType().equals(to.getField().getType())) {
307307
return false;
308308
}
309309
NonNullableStructVector that = (NonNullableStructVector) to;

0 commit comments

Comments
 (0)