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 2021/01/20 09:36:02 UTC

[GitHub] [druid] egor-ryashin commented on a change in pull request #10651: fixed input source sampler buildReader exp

egor-ryashin commented on a change in pull request #10651:
URL: https://github.com/apache/druid/pull/10651#discussion_r560815377



##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/sampler/InputSourceSampler.java
##########
@@ -103,90 +103,102 @@ public SamplerResponse sample(
     final File tempDir = FileUtils.createTempDir();
     closer.register(() -> FileUtils.deleteDirectory(tempDir));
 
-    final InputSourceReader reader = buildReader(
-        nonNullSamplerConfig,
-        nonNullDataSchema,
-        inputSource,
-        inputFormat,
-        tempDir
-    );
-    try (final CloseableIterator<InputRowListPlusRawValues> iterator = reader.sample();
-         final IncrementalIndex<Aggregator> index = buildIncrementalIndex(nonNullSamplerConfig, nonNullDataSchema);
-         final Closer closer1 = closer) {
-      List<SamplerResponseRow> responseRows = new ArrayList<>(nonNullSamplerConfig.getNumRows());
-      int numRowsIndexed = 0;
-
-      while (responseRows.size() < nonNullSamplerConfig.getNumRows() && iterator.hasNext()) {
-        final InputRowListPlusRawValues inputRowListPlusRawValues = iterator.next();
-
-        final List<Map<String, Object>> rawColumnsList = inputRowListPlusRawValues.getRawValuesList();
-
-        final ParseException parseException = inputRowListPlusRawValues.getParseException();
-        if (parseException != null) {
-          if (rawColumnsList != null) {
-            // add all rows to response
-            responseRows.addAll(rawColumnsList.stream()
-                                              .map(rawColumns -> new SamplerResponseRow(rawColumns, null, true, parseException.getMessage()))
-                                              .collect(Collectors.toList()));
-          } else {
-            // no data parsed, add one response row
-            responseRows.add(new SamplerResponseRow(null, null, true, parseException.getMessage()));
+    try {
+      final InputSourceReader reader = buildReader(
+          nonNullSamplerConfig,
+          nonNullDataSchema,
+          inputSource,
+          inputFormat,
+          tempDir
+      );

Review comment:
       I guess that needs a UI test, unfortunately, it will take me more time than I have right now.




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