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 theLocalAppendableTable
for 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 aFile
representing the path where the table will be written.getTableWriter
(String columnPartitionValue, boolean forceAppend) Get aTableWriter
for the table and specified partition, optionally appending.Returns an unmodifiable collection ofDynamicTableWriter
objects in the order they were created.boolean
Confirms if theImportTableWriterFactory
was initialized to only support a single partition valueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:ImportTableWriterFactory
Get the table definition associated with the table that will be written.- Specified by:
getTableDefinition
in interfaceImportTableWriterFactory
- Returns:
- the table definition.
-
getTableDestination
Description copied from interface:ImportTableWriterFactory
Get aFile
representing the path where the table will be written.- Specified by:
getTableDestination
in 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:ImportTableWriterFactory
Returns theLocalAppendableTable
for given column partition value.- Specified by:
getLocalAppendableTable
in 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
LocalAppendableTable
for column partition value.
-
getTableWriter
Description copied from interface:ImportTableWriterFactory
Get aTableWriter
for the table and specified partition, optionally appending.- Specified by:
getTableWriter
in 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:ImportTableWriterFactory
The 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 returnnull
indicating that there is no valid column partition.- Specified by:
getComputedColumnPartition
in 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 ofDynamicTableWriter
objects in the order they were created.- Returns:
DynamicTableWriter
Collection 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 theImportTableWriterFactory
was not initialized with a SinglePartition Value then null will be returned.- Returns:
- the
DynamicTableWriter
mapped to the columnPartition value provided when theImportTableWriterFactory
was initialized.
-
isSinglePartitionMode
public boolean isSinglePartitionMode()Confirms if theImportTableWriterFactory
was 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
-