NobiGo commented on code in PR #4026:
URL: https://github.com/apache/calcite/pull/4026#discussion_r1825758975


##########
core/src/main/java/org/apache/calcite/rel/externalize/RelJson.java:
##########
@@ -939,10 +944,21 @@ public static <C extends Comparable<C>> Range<C> 
rangeFromJson(
   @SuppressWarnings({"rawtypes", "unchecked"})
   private static <C extends Comparable<C>> C rangeEndPointFromJson(Object o) {
     Exception e = null;
+    for (Class clsType : NUMERIC_VALUE_CLASSES) {
+      try {
+        if (OBJECT_MAPPER.readValue((String) o, 
clsType).toString().equals(o.toString())){
+          return (C) OBJECT_MAPPER.readValue((String) o, clsType);
+        } else {
+          throw new InvalidAttributesException("Incorrect conversion between 
approximate and exact numeric ");
+        }
+      } catch (JsonProcessingException|InvalidAttributesException  ex) {
+        e = ex;
+      }
+    }
     for (Class clsType : VALUE_CLASSES) {
       try {
-        return (C) OBJECT_MAPPER.readValue((String) o, clsType);
-      } catch (JsonProcessingException ex) {
+          return (C) OBJECT_MAPPER.readValue((String) o, clsType);

Review Comment:
   It seems that you are refactoring this PR. Please note that there are some 
unnecessary changes here.



-- 
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]

Reply via email to