Package org.apache.druid.data.input.impl
Class LocalInputSource
java.lang.Object
org.apache.druid.data.input.AbstractInputSource
org.apache.druid.data.input.impl.LocalInputSource
- All Implemented Interfaces:
SplittableInputSource<List<File>>,SystemFieldInputSource,InputSource
public class LocalInputSource
extends AbstractInputSource
implements SplittableInputSource<List<File>>, SystemFieldInputSource
-
Field Summary
FieldsFields inherited from interface org.apache.druid.data.input.InputSource
TYPE_PROPERTYFields inherited from interface org.apache.druid.data.input.impl.SplittableInputSource
DEFAULT_SPLIT_HINT_SPECFields inherited from interface org.apache.druid.data.input.impl.systemfield.SystemFieldInputSource
SYSTEM_FIELDS_PROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionLocalInputSource(File baseDir, String filter) LocalInputSource(File baseDir, String filter, List<File> files, SystemFields systemFields) -
Method Summary
Modifier and TypeMethodDescriptionStream<InputSplit<List<File>>>createSplits(InputFormat inputFormat, SplitHintSpec splitHintSpec) Creates aStreamofInputSplits.booleanintestimateNumSplits(InputFormat inputFormat, SplitHintSpec splitHintSpec) Returns an estimated total number of splits to be created viaSplittableInputSource.createSplits(org.apache.druid.data.input.InputFormat, org.apache.druid.data.input.SplitHintSpec).protected InputSourceReaderformattableReader(InputRowSchema inputRowSchema, InputFormat inputFormat, File temporaryDirectory) System fields that this input source is configured to return.getFiles()getSystemFieldValue(InputEntity entity, SystemField field) Compute the value of a system field for a particularInputEntity.getTypes()The types of input sources uses.inthashCode()booleanReturns true if this inputSource supports differentInputFormats.toString()withSplit(InputSplit<List<File>> split) Helper method for ParallelIndexSupervisorTask.Methods inherited from class org.apache.druid.data.input.AbstractInputSource
fixedFormatReader, readerMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.druid.data.input.InputSource
readerMethods inherited from interface org.apache.druid.data.input.impl.SplittableInputSource
getSplitHintSpecOrDefault, isSplittable
-
Field Details
-
TYPE_KEY
- See Also:
-
-
Constructor Details
-
LocalInputSource
public LocalInputSource(@Nullable File baseDir, @Nullable String filter, @Nullable List<File> files, @Nullable SystemFields systemFields) -
LocalInputSource
-
-
Method Details
-
getTypes
Description copied from interface:InputSourceThe types of input sources uses. A set is returned here, as some InputSource implementation allow for combining of multiple input sources.- Specified by:
getTypesin interfaceInputSource- Returns:
- The types of input sources uses
-
getBaseDir
-
getFilter
-
getConfiguredSystemFields
Description copied from interface:SystemFieldInputSourceSystem fields that this input source is configured to return. This is not the same set thatSystemFieldInputSource.getSystemFieldValue(InputEntity, SystemField)returns nonnull for. For example, if aLocalInputSourceis configured to returnSystemField.BUCKETthen it will show up in this list, even though its value is always null. For another example in a different direction, if aLocalInputSourceis *not* configured to returnSystemField.URI, then it will *not* show up in this list, even though its value fromSystemFieldInputSource.getSystemFieldValue(InputEntity, SystemField)would be nonnull.- Specified by:
getConfiguredSystemFieldsin interfaceSystemFieldInputSource
-
getSystemFields
-
getFiles
-
createSplits
public Stream<InputSplit<List<File>>> createSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec) Description copied from interface:SplittableInputSourceCreates aStreamofInputSplits. The returned stream is supposed to be evaluated lazily to avoid consuming too much memory. Note that this interface also hasSplittableInputSource.estimateNumSplits(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 withSplittableInputSource.estimateNumSplits(org.apache.druid.data.input.InputFormat, org.apache.druid.data.input.SplitHintSpec).- Specified by:
createSplitsin interfaceSplittableInputSource<List<File>>
-
estimateNumSplits
Description copied from interface:SplittableInputSourceReturns an estimated total number of splits to be created viaSplittableInputSource.createSplits(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 fromSplittableInputSource.createSplits(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 withSplittableInputSource.createSplits(org.apache.druid.data.input.InputFormat, org.apache.druid.data.input.SplitHintSpec).- Specified by:
estimateNumSplitsin interfaceSplittableInputSource<List<File>>
-
withSplit
Description copied from interface:SplittableInputSourceHelper method for ParallelIndexSupervisorTask. Most of implementations can simply create a new instance with the given split.- Specified by:
withSplitin interfaceSplittableInputSource<List<File>>
-
getSystemFieldValue
Description copied from interface:SystemFieldInputSourceCompute the value of a system field for a particularInputEntity.- Specified by:
getSystemFieldValuein interfaceSystemFieldInputSource
-
needsFormat
public boolean needsFormat()Description copied from interface:InputSourceReturns true if this inputSource supports differentInputFormats. Some inputSources such asLocalInputSourcecan store files of any format. These storage types require anInputFormatto be passed so thatInputSourceReadercan parse data properly. However, some storage types have a fixed format. For example, druid inputSource always reads segments. These inputSources should return false for this method.- Specified by:
needsFormatin interfaceInputSource
-
formattableReader
protected InputSourceReader formattableReader(InputRowSchema inputRowSchema, InputFormat inputFormat, @Nullable File temporaryDirectory) - Overrides:
formattableReaderin classAbstractInputSource
-
equals
-
hashCode
public int hashCode() -
toString
-