Skip to content

Commit e994e9c

Browse files
liyafan82Pindikura Ravindra
authored andcommitted
ARROW-6266: [Java] Resolve the ambiguous method overload in RangeEqualsVisitor
In RangeEqualsVisitor, there are overload methods for both super class and sub class. This will lead to unexpected behavior. For example, if we call RangeEqualsVisitor#visit(v), where v is a fixed width vector, the method actually called may be visit(ValueVector), which is unexpected. In general, in the visitor pattern, it is not a good idea to support method overload for both super class and sub-class as parameters. Closes apache#5100 from liyafan82/fly_0816_visit and squashes the following commits: 6b5e5c5 <liyafan82> Remove the general visit mothod f7ed538 <liyafan82> Resolve the ambiguous method overload in RangeEqualsVisitor Authored-by: liyafan82 <fan_li_ya@foxmail.com> Signed-off-by: Pindikura Ravindra <ravindra@dremio.com>
1 parent a4ef8c6 commit e994e9c

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,6 @@ public BufferAllocator getAllocator() {
260260

261261
@Override
262262
public boolean accept(RangeEqualsVisitor visitor) {
263-
return visitor.visit(getUnderlyingVector());
263+
return getUnderlyingVector().accept(visitor);
264264
}
265265
}

java/vector/src/main/java/org/apache/arrow/vector/compare/RangeEqualsVisitor.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ public boolean visit(ZeroVector left) {
112112
return validate(left);
113113
}
114114

115-
public boolean visit(ValueVector left) {
116-
throw new UnsupportedOperationException();
117-
}
118-
119115
protected boolean compareValueVector(ValueVector left, ValueVector right) {
120116
if (!typeCheckNeeded) {
121117
return true;

0 commit comments

Comments
 (0)