use of org.apache.druid.indexing.overlord.sampler.SamplerException in project druid by druid-io.
the class SeekableStreamSamplerSpec method sample.
@Override
public SamplerResponse sample() {
final InputSource inputSource;
final InputFormat inputFormat;
if (dataSchema.getParser() != null) {
inputSource = new FirehoseFactoryToInputSourceAdaptor(new SeekableStreamSamplerFirehoseFactory(), dataSchema.getParser());
inputFormat = null;
} else {
RecordSupplier<PartitionIdType, SequenceOffsetType, RecordType> recordSupplier;
try {
recordSupplier = createRecordSupplier();
} catch (Exception e) {
throw new SamplerException(e, "Unable to create RecordSupplier: %s", Throwables.getRootCause(e).getMessage());
}
inputSource = new RecordSupplierInputSource<>(ioConfig.getStream(), recordSupplier, ioConfig.isUseEarliestSequenceNumber());
inputFormat = Preconditions.checkNotNull(ioConfig.getInputFormat(), "[spec.ioConfig.inputFormat] is required");
}
return inputSourceSampler.sample(inputSource, inputFormat, dataSchema, samplerConfig);
}
Aggregations