Skip to content

Commit

Permalink
ARROW-6266: [Java] Resolve the ambiguous method overload in RangeEqua…
Browse files Browse the repository at this point in the history
…lsVisitor

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 #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 <[email protected]>
Signed-off-by: Pindikura Ravindra <[email protected]>
  • Loading branch information
liyafan82 authored and Pindikura Ravindra committed Aug 19, 2019
1 parent a4ef8c6 commit e994e9c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,6 @@ public BufferAllocator getAllocator() {

@Override
public boolean accept(RangeEqualsVisitor visitor) {
return visitor.visit(getUnderlyingVector());
return getUnderlyingVector().accept(visitor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ public boolean visit(ZeroVector left) {
return validate(left);
}

public boolean visit(ValueVector left) {
throw new UnsupportedOperationException();
}

protected boolean compareValueVector(ValueVector left, ValueVector right) {
if (!typeCheckNeeded) {
return true;
Expand Down

0 comments on commit e994e9c

Please sign in to comment.