asereda-gs commented on a change in pull request #1313: [CALCITE-3190] 
ElasticsearchJson throws Exception when visitMappingProperties
URL: https://github.com/apache/calcite/pull/1313#discussion_r302357829
 
 

 ##########
 File path: 
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchJson.java
 ##########
 @@ -123,10 +123,12 @@ private static void visitMappingProperties(Deque<String> 
path,
     Iterable<Map.Entry<String, JsonNode>> iter = mapping::fields;
     for (Map.Entry<String, JsonNode> entry : iter) {
       final String name = entry.getKey();
-      final ObjectNode node = (ObjectNode) entry.getValue();
-      path.add(name);
-      visitMappingProperties(path, node, consumer);
-      path.removeLast();
+      if (entry.getValue() instanceof ObjectNode) {
+        final ObjectNode node = (ObjectNode) entry.getValue();
+        path.add(name);
+        visitMappingProperties(path, node, consumer);
+        path.removeLast();
+      }
 
 Review comment:
   maybe it's better to restricting visiting nodes to just subtree of 
`*/properties/` ? 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to