You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "olivrlee (via GitHub)" <gi...@apache.org> on 2023/04/11 22:31:13 UTC

[GitHub] [calcite] olivrlee commented on a diff in pull request #3140: [CALCITE-5614] Serialize / deserialize Sarg

olivrlee commented on code in PR #3140:
URL: https://github.com/apache/calcite/pull/3140#discussion_r1163393834


##########
core/src/main/java/org/apache/calcite/rel/externalize/RelJson.java:
##########
@@ -657,7 +721,7 @@ public RexNode toRex(RelOptCluster cluster, Object o) {
     final RexBuilder rexBuilder = cluster.getRexBuilder();
     if (o == null) {
       return null;
-    } else if (o instanceof Map) {
+    } else if (Map.class.isAssignableFrom(o.getClass())) {
       final Map<String, @Nullable Object> map = (Map) o;

Review Comment:
   This change is actually to allow support for classes such as [gson LinkedHashMap](https://github.com/google/gson/blob/master/gson/src/main/java/com/google/gson/internal/LinkedTreeMap.java).
   Without this change, `o instance of Map` would fail for this class. 
   
   We were making assumptions on what type of JSON deserialization library is being used.
   
   
   I'll add a comment above to clarify this 



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org