You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2020/09/12 05:35:56 UTC

[GitHub] [druid] jihoonson commented on a change in pull request #10383: Fix ingestion failure of pretty-formatted JSON message

jihoonson commented on a change in pull request #10383:
URL: https://github.com/apache/druid/pull/10383#discussion_r487371583



##########
File path: core/src/main/java/org/apache/druid/data/input/impl/JsonReader.java
##########
@@ -49,41 +55,99 @@
       boolean keepNullColumns
   )
   {
-    super(inputRowSchema, source);
+    this.inputRowSchema = inputRowSchema;
+    this.source = source;
     this.flattener = ObjectFlatteners.create(flattenSpec, new JSONFlattenerMaker(keepNullColumns));
     this.mapper = mapper;
   }
 
-  @Override
-  public List<InputRow> parseInputRows(String line) throws IOException, ParseException
-  {
-    final JsonNode document = mapper.readValue(line, JsonNode.class);
-    final Map<String, Object> flattened = flattener.flatten(document);
-    return Collections.singletonList(MapInputRowParser.parse(getInputRowSchema(), flattened));
-  }
 
   @Override
-  public Map<String, Object> toMap(String intermediateRow) throws IOException
+  public CloseableIterator<InputRow> read() throws IOException
   {
-    //noinspection unchecked
-    return mapper.readValue(intermediateRow, Map.class);
+    final MappingIterator<JsonNode> delegate = mapper.readValues(
+        new JsonFactory().createParser(this.source.open()),

Review comment:
       The `parser` created from `JsonFactory` is `Closeable` which should be closed when the below `CloseableIterator` is closed. 




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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org