Class ParquetTableWriter

java.lang.Object
com.illumon.iris.db.v2.parquet.ParquetTableWriter

public class ParquetTableWriter extends Object
API for writing DH tables in parquet format
  • Field Details

  • Constructor Details

    • ParquetTableWriter

      public ParquetTableWriter()
  • Method Details

    • write

      public static void write(@NotNull Table table, @NotNull TableDefinition definition, @NotNull ParquetInstructions writeInstructions, @NotNull String path, @NotNull Map<String,String> tableMeta) throws SchemaMappingException, IOException
      Writes a table in parquet format under a given path
      Parameters:
      table - The table to write
      definition - The table definition
      writeInstructions - Write instructions for customizations while writing
      path - The destination path
      tableMeta - A map of metadata values to be stores in the file footer
      Throws:
      SchemaMappingException - Error creating a parquet table schema for the given table (likely due to unsupported types)
      IOException - For file writing related errors
    • write

      public static void write(@NotNull Table table, @NotNull TableDefinition definition, @NotNull ParquetInstructions writeInstructions, @NotNull String path, @NotNull Map<String,String> tableMeta, @NotNull TableInfo.Builder tableInfoBuilder) throws SchemaMappingException, IOException
      Writes a table in parquet format under a given path
      Parameters:
      table - The table to write
      definition - The table definition
      writeInstructions - Write instructions for customizations while writing
      path - The destination path
      tableMeta - A map of metadata values to be stores in the file footer
      tableInfoBuilder - A partially-constructed builder for the metadata object
      Throws:
      SchemaMappingException - Error creating a parquet table schema for the given table (likely due to unsupported types)
      IOException - For file writing related errors
    • write

      @VisibleForTesting protected static void write(@NotNull Table table, @NotNull TableDefinition definition, @NotNull ParquetInstructions writeInstructions, @NotNull io.deephaven.parquet.base.ParquetFileWriter parquetFileWriter, @NotNull Map<String,Map<ParquetCacheTags,Object>> computedCache) throws IOException
      Writes a table in parquet format under a given path. This method should only be invoked when wrapped in a try-with-resources using a new LivenessScope to ensure that the various derived tables created are properly cleaned up.
      Parameters:
      table - The table to write
      definition - The table definition
      writeInstructions - Write instructions for customizations while writing
      parquetFileWriter - the writer
      Throws:
      IOException - For file writing related errors
    • pretransformTable

      @NotNull @InternalUseOnly public static Table pretransformTable(@NotNull Table table, @NotNull TableDefinition definition)
      Detect any missing or StringSet columns and convert them to arrays / null values as appropriate to prepare the input table to be written to the parquet file.
      Parameters:
      table - the input table
      definition - the table definition being written
      Returns:
      a transformed view of the input table.
    • getParquetFileWriter

      @NotNull @InternalUseOnly public static io.deephaven.parquet.base.ParquetFileWriter getParquetFileWriter(@NotNull Map<String,Map<ParquetCacheTags,Object>> computedCache, @NotNull TableDefinition definition, @NotNull ReadOnlyIndex tableRowSet, @NotNull Map<String,? extends ColumnSource> columnSourceMap, @NotNull String path, @NotNull ParquetInstructions writeInstructions, @NotNull Map<String,String> tableMeta, @NotNull TableInfo.Builder tableInfoBuilder) throws IOException
      Create a ParquetFileWriter for writing the table to disk.
      Parameters:
      computedCache - Per column cache tags
      definition - the writable definition
      tableRowSet - the index being written
      columnSourceMap - the columns of the table
      path - the destination to write to
      writeInstructions - write instructions for the file
      tableMeta - metadata to include in the parquet metadata
      tableInfoBuilder - a builder for accumulating per-column information to construct the deephaven metadata
      Returns:
      a new file writer
      Throws:
      IOException
    • writeColumnSource

      @InternalUseOnly public static <DATA_TYPE> void writeColumnSource(@NotNull Map<String,Map<ParquetCacheTags,Object>> computedCache, @NotNull Index tableRowSet, @NotNull io.deephaven.parquet.base.RowGroupWriter rowGroupWriter, @NotNull String name, @NotNull ColumnSource<DATA_TYPE> columnSourceIn, @NotNull com.illumon.dataobjects.ColumnDefinition<DATA_TYPE> columnDefinition, @NotNull ParquetInstructions writeInstructions) throws IllegalAccessException, IOException
      Throws:
      IllegalAccessException
      IOException