File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
main/java/org/apache/arrow/vector/compare
test/java/org/apache/arrow/vector Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 2424import org .apache .arrow .util .Preconditions ;
2525import org .apache .arrow .vector .BaseFixedWidthVector ;
2626import org .apache .arrow .vector .BaseVariableWidthVector ;
27+ import org .apache .arrow .vector .DecimalVector ;
2728import org .apache .arrow .vector .NullVector ;
2829import org .apache .arrow .vector .ValueVector ;
2930import org .apache .arrow .vector .complex .BaseRepeatedValueVector ;
3031import org .apache .arrow .vector .complex .FixedSizeListVector ;
3132import org .apache .arrow .vector .complex .ListVector ;
3233import org .apache .arrow .vector .complex .NonNullableStructVector ;
3334import org .apache .arrow .vector .complex .UnionVector ;
35+ import org .apache .arrow .vector .types .pojo .ArrowType ;
3436
3537/**
3638 * Visitor to compare a range of values for vectors.
@@ -244,7 +246,23 @@ protected boolean compareStructVectors(Range range) {
244246 return true ;
245247 }
246248
249+ private boolean compareDecimalVectorTypes () {
250+ ArrowType .Decimal leftType = (ArrowType .Decimal ) left .getField ().getType ();
251+ ArrowType .Decimal rightType = (ArrowType .Decimal ) right .getField ().getType ();
252+
253+ if (leftType .getPrecision () != rightType .getPrecision () || leftType .getScale () != rightType .getScale ()) {
254+ return false ;
255+ }
256+ return true ;
257+ }
258+
247259 protected boolean compareBaseFixedWidthVectors (Range range ) {
260+ if (left instanceof DecimalVector ) {
261+ if (!compareDecimalVectorTypes ()) {
262+ return false ;
263+ }
264+ }
265+
248266 BaseFixedWidthVector leftVector = (BaseFixedWidthVector ) left ;
249267 BaseFixedWidthVector rightVector = (BaseFixedWidthVector ) right ;
250268
Original file line number Diff line number Diff line change @@ -2320,7 +2320,7 @@ public void testDecimalVectorEquals() {
23202320 VectorEqualsVisitor visitor2 = new VectorEqualsVisitor ();
23212321
23222322 assertTrue (visitor1 .vectorEquals (vector1 , vector2 ));
2323- assertTrue (visitor2 .vectorEquals (vector1 , vector3 ));
2323+ assertFalse (visitor2 .vectorEquals (vector1 , vector3 ));
23242324 }
23252325 }
23262326
You can’t perform that action at this time.
0 commit comments