FrankChen021 commented on a change in pull request #10383:
URL: https://github.com/apache/druid/pull/10383#discussion_r520275818
##########
File path:
indexing-service/src/main/java/org/apache/druid/indexing/overlord/sampler/InputSourceSampler.java
##########
@@ -111,38 +113,49 @@ public SamplerResponse sample(
try (final CloseableIterator<InputRowListPlusRawValues> iterator =
reader.sample();
final IncrementalIndex<Aggregator> index =
buildIncrementalIndex(nonNullSamplerConfig, nonNullDataSchema);
final Closer closer1 = closer) {
- SamplerResponseRow[] responseRows = new
SamplerResponseRow[nonNullSamplerConfig.getNumRows()];
- int counter = 0, numRowsIndexed = 0;
-
- while (counter < responseRows.length && iterator.hasNext()) {
- Map<String, Object> rawColumns = null;
- try {
- final InputRowListPlusRawValues inputRowListPlusRawValues =
iterator.next();
-
- if (inputRowListPlusRawValues.getRawValues() != null) {
- rawColumns = inputRowListPlusRawValues.getRawValues();
- }
-
- if (inputRowListPlusRawValues.getParseException() != null) {
- throw inputRowListPlusRawValues.getParseException();
+ 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()));
Review comment:
Yes, returning the whole `rawColumnsList` involves some changes at the
web-console side which is currently out of my ability. Thanks for understanding.
----------------------------------------------------------------
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]