ARROW-6311: [Java] Make ApproxEqualsVisitor accept DiffFunction to make it more flexible#5155
ARROW-6311: [Java] Make ApproxEqualsVisitor accept DiffFunction to make it more flexible#5155tianchen92 wants to merge 1 commit intoapache:masterfrom
Conversation
…ke it more flexible
|
cc @pravindra |
pravindra
left a comment
There was a problem hiding this comment.
the change lgtm. some minor questions
- is it useful to have different epsilons for floats and doubles (i guess a double epsilon can cover both)?
- did you consider using a Java.Util.Comparator instead of the diff functions ?
Thanks for your comments,
java.util.comparator seems only compare two values which is larger i think can’t handle this? |
…ke it more flexible Related to [ARROW-6311](https://issues.apache.org/jira/browse/ARROW-6311). Currently ApproxEqualsVisitor will accept a epsilon for both float and double compare, and the difference calculation is always Math.abs(f1-f2) For some cases like Validator it is not very suitable as: i. it has different epsilon values for float/double ii. it difference function is not Math.abs(f1-f2) To resolve these, make this visitor accept both float/double epsilons and diff functions. Closes apache#5155 from tianchen92/ARROW-6311 and squashes the following commits: 41a5dba <tianchen> ARROW-6311: Make ApproxEqualsVisitor accept DiffFunction to make it more flexible Authored-by: tianchen <niki.lj@alibaba-inc.com> Signed-off-by: Pindikura Ravindra <ravindra@dremio.com>
Related to ARROW-6311.
Currently ApproxEqualsVisitor will accept a epsilon for both float and double compare, and the difference calculation is always Math.abs(f1-f2)
For some cases like Validator it is not very suitable as:
i. it has different epsilon values for float/double
ii. it difference function is not Math.abs(f1-f2)
To resolve these, make this visitor accept both float/double epsilons and diff functions.