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



##########
File path: 
core/src/main/java/org/apache/druid/data/input/IntermediateRowParsingReader.java
##########
@@ -96,23 +101,45 @@ public void close() throws IOException
   public CloseableIterator<InputRowListPlusRawValues> sample() throws 
IOException
   {
     return intermediateRowIterator().map(row -> {
-      final Map<String, Object> rawColumns;
+
+      final List<Map<String, Object>> rawColumnsList;
       try {
-        rawColumns = toMap(row);
+        rawColumnsList = toMap(row);
       }
       catch (Exception e) {
-        return InputRowListPlusRawValues.of(null, new ParseException(e, 
"Unable to parse row [%s] into JSON", row));
+        return Collections.singletonList(InputRowListPlusRawValues.of(null,
+                                                                      new 
ParseException(e, "Unable to parse row [%s] into JSON", row)));
+      }
+
+      if (CollectionUtils.isNullOrEmpty(rawColumnsList)) {
+        return Collections.singletonList(InputRowListPlusRawValues.of(null,
+                                                                      new 
ParseException("No map object parsed for row [%s]", row)));
       }
+
+      List<InputRow> rows;
       try {
-        return InputRowListPlusRawValues.of(parseInputRows(row), rawColumns);
+        rows = parseInputRows(row);
       }
       catch (ParseException e) {
-        return InputRowListPlusRawValues.of(rawColumns, e);
+        return rawColumnsList.stream().map(rawColumn -> 
InputRowListPlusRawValues.of(rawColumn, e)).collect(Collectors.toList());
       }
       catch (IOException e) {
-        return InputRowListPlusRawValues.of(rawColumns, new ParseException(e, 
"Unable to parse row [%s] into inputRow", row));
+        ParseException exception = new ParseException(e, "Unable to parse row 
[%s] into inputRow", row);
+        return rawColumnsList.stream().map(rawColumn -> 
InputRowListPlusRawValues.of(rawColumn, 
exception)).collect(Collectors.toList());
+      }

Review comment:
       I agree with you. 
   
   `rawValues` in `InputRowListPlusRawValues` should also be a list to 
correspond the list of `inputRows`. Since the `rawValues` is also passed to 
`SamplerResponseRow` when exception occurs, to change `rawValues` from `Map` to 
`List<Map>` also involves changes of the web console. I don't know if the 
change of front-end should also be included in this PR.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to