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 Details

    • PreviewTableImportTableWriterFactory

      public PreviewTableImportTableWriterFactory(@NotNull Schema schema, @NotNull String internalPartitionValue, @Nullable String columnPartitionValue)
      Constructor.
      Parameters:
      schema - The schema definition of the table being imported
      internalPartitionValue - The internal partition used in creating location key for each partition
      columnPartitionValue - Optional partition value to use, should be not null in case of Single Partition value imports
  • Method Details

    • getTableDefinition

      public TableDefinition getTableDefinition()
      Description copied from interface: ImportTableWriterFactory
      Get the table definition associated with the table that will be written.
      Specified by:
      getTableDefinition in interface ImportTableWriterFactory
      Returns:
      the table definition.
    • getTableDestination

      @NotNull public File getTableDestination(String columnPartitionValue)
      Description copied from interface: ImportTableWriterFactory
      Get a File representing the path where the table will be written.
      Specified by:
      getTableDestination in interface ImportTableWriterFactory
      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 the LocalAppendableTable for given column partition value.
      Specified by:
      getLocalAppendableTable in interface ImportTableWriterFactory
      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

      public TableWriter getTableWriter(String columnPartitionValue, boolean forceAppend)
      Description copied from interface: ImportTableWriterFactory
      Get a TableWriter for the table and specified partition, optionally appending.
      Specified by:
      getTableWriter in interface ImportTableWriterFactory
      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

      @Nullable public String getComputedColumnPartition(@Nullable String inputColumnPartition)
      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 return null indicating that there is no valid column partition.
      Specified by:
      getComputedColumnPartition in interface ImportTableWriterFactory
      Parameters:
      inputColumnPartition - the requested input partition
      Returns:
      the computed column partition
    • getColumnPartitionValue

      @Nullable public String 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

      public Collection<DynamicTableWriter> getWriters()
      Returns an unmodifiable collection of DynamicTableWriter objects in the order they were created.
      Returns:
      DynamicTableWriter Collection of table writers in the order they were created
    • getPartitionValuesSet

      public Set<String> 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

      @Nullable public DynamicTableWriter getSinglePartitionTableWriter()
      Returns the Single PartitionValues Writer for the partition value used in constructor. If the ImportTableWriterFactory was not initialized with a SinglePartition Value then null will be returned.
      Returns:
      the DynamicTableWriter mapped to the columnPartition value provided when the ImportTableWriterFactory was initialized.
    • isSinglePartitionMode

      public boolean isSinglePartitionMode()
      Confirms if the ImportTableWriterFactory 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