Package com.illumon.iris.importers
Class PreviewTableImportTableWriterFactory
java.lang.Object
com.illumon.iris.importers.PreviewTableImportTableWriterFactory
- All Implemented Interfaces:
ImportTableWriterFactory
public class PreviewTableImportTableWriterFactory
extends Object
implements ImportTableWriterFactory
ImportTableWriterFactory implementation used in Preview Import Table functionality.
Supports both Single Partition Value import and MultiPartition.-
Constructor Summary
ConstructorsConstructorDescriptionPreviewTableImportTableWriterFactory(Schema schema, String internalPartitionValue, String columnPartitionValue) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the single partition value passed in the constructor.getComputedColumnPartition(String inputColumnPartition) The method is invoked to determine the partition value to which the current row of data needs to be associated.getLocalAppendableTable(String partitionValue, boolean forceAppend) Returns theLocalAppendableTablefor given column partition value.Returns an unmodifiable ordered set of partition values used to create the table destinations in the import.Returns the Single PartitionValues Writer for the partition value used in constructor.Get the table definition associated with the table that will be written.getTableDestination(String columnPartitionValue) Get aFilerepresenting the path where the table will be written.getTableWriter(String columnPartitionValue, boolean forceAppend) Get aTableWriterfor the table and specified partition, optionally appending.Returns an unmodifiable collection ofDynamicTableWriterobjects in the order they were created.booleanConfirms if theImportTableWriterFactorywas initialized to only support a single partition valueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.importers.ImportTableWriterFactory
getTableWriter
-
Constructor Details
-
PreviewTableImportTableWriterFactory
public PreviewTableImportTableWriterFactory(@NotNull Schema schema, @NotNull String internalPartitionValue, @Nullable String columnPartitionValue) Constructor.- Parameters:
schema- The schema definition of the table being importedinternalPartitionValue- The internal partition used in creating location key for each partitioncolumnPartitionValue- Optional partition value to use, should be not null in case of Single Partition value imports
-
-
Method Details
-
getTableDefinition
Description copied from interface:ImportTableWriterFactoryGet the table definition associated with the table that will be written.- Specified by:
getTableDefinitionin interfaceImportTableWriterFactory- Returns:
- the table definition.
-
getTableDestination
Description copied from interface:ImportTableWriterFactoryGet aFilerepresenting the path where the table will be written.- Specified by:
getTableDestinationin interfaceImportTableWriterFactory- Parameters:
columnPartitionValue- the column partition to find the destination for- Returns:
- a file at the path the table will be written.
-
getLocalAppendableTable
@NotNull public LocalAppendableTable getLocalAppendableTable(String partitionValue, boolean forceAppend) Description copied from interface:ImportTableWriterFactoryReturns theLocalAppendableTablefor given column partition value.- Specified by:
getLocalAppendableTablein interfaceImportTableWriterFactory- Parameters:
partitionValue- the column partition to use. Some implementations allow nulls.forceAppend- When true, the LocalAppendableTable will be initialized to append to any existing data. When false, append/replace/fail behavior is implementation defined.- Returns:
- Returned appropriate
LocalAppendableTablefor column partition value.
-
getTableWriter
Description copied from interface:ImportTableWriterFactoryGet aTableWriterfor the table and specified partition, optionally appending.- Specified by:
getTableWriterin interfaceImportTableWriterFactory- Parameters:
columnPartitionValue- the column partition to use. Some implementations allow nulls.forceAppend- if the table should be appended or replaced.- Returns:
- an appropriate
TableWriter
-
getComputedColumnPartition
Description copied from interface:ImportTableWriterFactoryThe method is invoked to determine the partition value to which the current row of data needs to be associated. So in the case where user wants a single partition value for the import this should return that value. In other cases this may simply return the passed in value, however, it is possible to returnnullindicating that there is no valid column partition.- Specified by:
getComputedColumnPartitionin interfaceImportTableWriterFactory- Parameters:
inputColumnPartition- the requested input partition- Returns:
- the computed column partition
-
getColumnPartitionValue
Returns the single partition value passed in the constructor. A non-null value indicates that the import was done using a single partition value.- Returns:
- the partition value passed in constructor
-
getWriters
Returns an unmodifiable collection ofDynamicTableWriterobjects in the order they were created.- Returns:
DynamicTableWriterCollection of table writers in the order they were created
-
getPartitionValuesSet
Returns an unmodifiable ordered set of partition values used to create the table destinations in the import.- Returns:
- an instance of ordered set of partition values
-
getSinglePartitionTableWriter
Returns the Single PartitionValues Writer for the partition value used in constructor. If theImportTableWriterFactorywas not initialized with a SinglePartition Value then null will be returned.- Returns:
- the
DynamicTableWritermapped to the columnPartition value provided when theImportTableWriterFactorywas initialized.
-
isSinglePartitionMode
public boolean isSinglePartitionMode()Confirms if theImportTableWriterFactorywas initialized to only support a single partition value- Returns:
- true is the factory was initialized with a non-null and non-empty value for column partition
-