Package com.illumon.iris.db.v2.parquet
Class ParquetTableWriter
java.lang.Object
com.illumon.iris.db.v2.parquet.ParquetTableWriter
API for writing DH tables in parquet format
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic io.deephaven.parquet.base.ParquetFileWriter
getParquetFileWriter
(Map<String, Map<ParquetCacheTags, Object>> computedCache, TableDefinition definition, ReadOnlyIndex tableRowSet, Map<String, ? extends ColumnSource> columnSourceMap, String path, ParquetInstructions writeInstructions, Map<String, String> tableMeta, TableInfo.Builder tableInfoBuilder) Create aParquetFileWriter
for writing the table to disk.static Table
pretransformTable
(Table table, 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.protected static void
write
(Table table, TableDefinition definition, ParquetInstructions writeInstructions, io.deephaven.parquet.base.ParquetFileWriter parquetFileWriter, Map<String, Map<ParquetCacheTags, Object>> computedCache) Writes a table in parquet format under a given path.static void
write
(Table table, TableDefinition definition, ParquetInstructions writeInstructions, String path, Map<String, String> tableMeta) Writes a table in parquet format under a given pathstatic void
write
(Table table, TableDefinition definition, ParquetInstructions writeInstructions, String path, Map<String, String> tableMeta, TableInfo.Builder tableInfoBuilder) Writes a table in parquet format under a given pathstatic <DATA_TYPE>
voidwriteColumnSource
(Map<String, Map<ParquetCacheTags, Object>> computedCache, Index tableRowSet, io.deephaven.parquet.base.RowGroupWriter rowGroupWriter, String name, ColumnSource<DATA_TYPE> columnSourceIn, com.illumon.dataobjects.ColumnDefinition<DATA_TYPE> columnDefinition, ParquetInstructions writeInstructions)
-
Field Details
-
METADATA_KEY
- See Also:
-
PARQUET_FILE_EXTENSION
- See Also:
-
-
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, IOExceptionWrites a table in parquet format under a given path- Parameters:
table
- The table to writedefinition
- The table definitionwriteInstructions
- Write instructions for customizations while writingpath
- The destination pathtableMeta
- 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, IOExceptionWrites a table in parquet format under a given path- Parameters:
table
- The table to writedefinition
- The table definitionwriteInstructions
- Write instructions for customizations while writingpath
- The destination pathtableMeta
- A map of metadata values to be stores in the file footertableInfoBuilder
- 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, throws IOExceptionObject>> computedCache) 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 newLivenessScope
to ensure that the various derived tables created are properly cleaned up.- Parameters:
table
- The table to writedefinition
- The table definitionwriteInstructions
- Write instructions for customizations while writingparquetFileWriter
- 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 tabledefinition
- 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, throws IOExceptionObject>> 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) Create aParquetFileWriter
for writing the table to disk.- Parameters:
computedCache
- Per column cache tagsdefinition
- the writable definitiontableRowSet
- the index being writtencolumnSourceMap
- the columns of the tablepath
- the destination to write towriteInstructions
- write instructions for the filetableMeta
- metadata to include in the parquet metadatatableInfoBuilder
- 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, throws IllegalAccessException, IOExceptionObject>> 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
-