mirror of https://github.com/apache/druid.git
fixed input source sampler buildReader exp
This commit is contained in:
parent
b7641f644c
commit
e688db8503
|
@ -103,6 +103,7 @@ public class InputSourceSampler
|
|||
final File tempDir = FileUtils.createTempDir();
|
||||
closer.register(() -> FileUtils.deleteDirectory(tempDir));
|
||||
|
||||
try {
|
||||
final InputSourceReader reader = buildReader(
|
||||
nonNullSamplerConfig,
|
||||
nonNullDataSchema,
|
||||
|
@ -126,7 +127,12 @@ public class InputSourceSampler
|
|||
if (rawColumnsList != null) {
|
||||
// add all rows to response
|
||||
responseRows.addAll(rawColumnsList.stream()
|
||||
.map(rawColumns -> new SamplerResponseRow(rawColumns, null, true, parseException.getMessage()))
|
||||
.map(rawColumns -> new SamplerResponseRow(
|
||||
rawColumns,
|
||||
null,
|
||||
true,
|
||||
parseException.getMessage()
|
||||
))
|
||||
.collect(Collectors.toList()));
|
||||
} else {
|
||||
// no data parsed, add one response row
|
||||
|
@ -149,7 +155,12 @@ public class InputSourceSampler
|
|||
final int rowIndex = responseRows.size();
|
||||
IncrementalIndexAddResult addResult = index.add(new SamplerInputRow(row, rowIndex), true);
|
||||
if (addResult.hasParseException()) {
|
||||
responseRows.add(new SamplerResponseRow(rawColumns, null, true, addResult.getParseException().getMessage()));
|
||||
responseRows.add(new SamplerResponseRow(
|
||||
rawColumns,
|
||||
null,
|
||||
true,
|
||||
addResult.getParseException().getMessage()
|
||||
));
|
||||
} else {
|
||||
// store the raw value; will be merged with the data from the IncrementalIndex later
|
||||
responseRows.add(new SamplerResponseRow(rawColumns, null, null, null));
|
||||
|
@ -188,6 +199,7 @@ public class InputSourceSampler
|
|||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new SamplerException(e, "Failed to sample data: %s", e.getMessage());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue