Diveyam-Mishra commented on code in PR #5048:
URL: https://github.com/apache/calcite/pull/5048#discussion_r3489687196
##########
file/src/main/java/org/apache/calcite/adapter/file/CsvEnumerator.java:
##########
@@ -254,6 +262,19 @@ static CSVReader openCsv(Source source, char separator)
throws IOException {
return new CSVReader(source.reader(), separator);
}
+ private static boolean objectsEqual(@Nullable Object o1, @Nullable Object
o2) {
+ if (o1 == o2) {
+ return true;
+ }
+ if (o1 == null || o2 == null) {
+ return false;
+ }
+ if (o1 instanceof BigDecimal && o2 instanceof BigDecimal) {
Review Comment:
The core problem is that BigDecimal violates the intuitive expectation that
"same number = equal object":
javanew BigDecimal("2.0").equals(new BigDecimal("2.00")) // false
new BigDecimal("2.0").compareTo(new BigDecimal("2.00")) == 0 // true
##########
file/src/main/java/org/apache/calcite/adapter/file/CsvEnumerator.java:
##########
@@ -254,6 +262,19 @@ static CSVReader openCsv(Source source, char separator)
throws IOException {
return new CSVReader(source.reader(), separator);
}
+ private static boolean objectsEqual(@Nullable Object o1, @Nullable Object
o2) {
+ if (o1 == o2) {
+ return true;
+ }
+ if (o1 == null || o2 == null) {
+ return false;
+ }
+ if (o1 instanceof BigDecimal && o2 instanceof BigDecimal) {
Review Comment:
The core problem is that BigDecimal violates the intuitive expectation that
"same number = equal object":
new BigDecimal("2.0").equals(new BigDecimal("2.00")) // false
new BigDecimal("2.0").compareTo(new BigDecimal("2.00")) == 0 // true
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]