Package org.apache.druid.data.input.impl
Interface SplittableInputSource<T>
- All Superinterfaces:
InputSource
- All Known Implementing Classes:
CloudObjectInputSource,CombiningInputSource,HttpInputSource,LocalInputSource
Splittable InputSource. ParallelIndexSupervisorTask can process
InputSplits in parallel.-
Field Summary
FieldsFields inherited from interface org.apache.druid.data.input.InputSource
TYPE_PROPERTY -
Method Summary
Modifier and TypeMethodDescriptioncreateSplits(InputFormat inputFormat, SplitHintSpec splitHintSpec) Creates aStreamofInputSplits.intestimateNumSplits(InputFormat inputFormat, SplitHintSpec splitHintSpec) Returns an estimated total number of splits to be created viacreateSplits(org.apache.druid.data.input.InputFormat, org.apache.druid.data.input.SplitHintSpec).default SplitHintSpecgetSplitHintSpecOrDefault(SplitHintSpec splitHintSpec) default booleanReturns true if this inputSource can be processed in parallel using ParallelIndexSupervisorTask.withSplit(InputSplit<T> split) Helper method for ParallelIndexSupervisorTask.Methods inherited from interface org.apache.druid.data.input.InputSource
getTypes, needsFormat, reader
-
Field Details
-
DEFAULT_SPLIT_HINT_SPEC
-
-
Method Details
-
isSplittable
default boolean isSplittable()Description copied from interface:InputSourceReturns true if this inputSource can be processed in parallel using ParallelIndexSupervisorTask. It must be castable to SplittableInputSource and the various SplittableInputSource methods must work as documented.- Specified by:
isSplittablein interfaceInputSource
-
createSplits
Stream<InputSplit<T>> createSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec) throws IOException Creates aStreamofInputSplits. The returned stream is supposed to be evaluated lazily to avoid consuming too much memory. Note that this interface also hasestimateNumSplits(org.apache.druid.data.input.InputFormat, org.apache.druid.data.input.SplitHintSpec)which is related to this method. The implementations should be careful to NOT cache the created splits in memory. Implementations can considerInputFormat.isSplittable()andSplitHintSpecto create splits in the same way withestimateNumSplits(org.apache.druid.data.input.InputFormat, org.apache.druid.data.input.SplitHintSpec).- Throws:
IOException
-
estimateNumSplits
int estimateNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec) throws IOException Returns an estimated total number of splits to be created viacreateSplits(org.apache.druid.data.input.InputFormat, org.apache.druid.data.input.SplitHintSpec). The estimated number of splits doesn't have to be accurate and can be different from the actual number of InputSplits returned fromcreateSplits(org.apache.druid.data.input.InputFormat, org.apache.druid.data.input.SplitHintSpec). This will be used to estimate the progress of a phase in parallel indexing. See TaskMonitor for more details of the progress estimation. This method can be expensive if an implementation iterates all directories or whatever substructure to find all input entities. Implementations can considerInputFormat.isSplittable()andSplitHintSpecto find splits in the same way withcreateSplits(org.apache.druid.data.input.InputFormat, org.apache.druid.data.input.SplitHintSpec).- Throws:
IOException
-
withSplit
Helper method for ParallelIndexSupervisorTask. Most of implementations can simply create a new instance with the given split. -
getSplitHintSpecOrDefault
-