You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/07/10 08:46:31 UTC

[GitHub] [calcite] durpersi commented on a change in pull request #1313: [CALCITE-3190] ElasticsearchJson throws Exception when visitMappingProperties

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

 ##########
 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:
   An exception occurs when value node is encountered, but we don't need to handle ValueNode.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services