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 @NotNull ParquetFileWritergetParquetFileWriter(@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, TableInfo.Builder tableInfoBuilder) Create aParquetFileWriterfor writing the table to disk.static @NotNull TablepretransformTable(@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.protected static voidwrite(@NotNull Table table, @NotNull TableDefinition definition, @NotNull ParquetInstructions writeInstructions, @NotNull ParquetFileWriter parquetFileWriter, @NotNull Map<String, Map<ParquetCacheTags, Object>> computedCache) Writes a table in parquet format under a given path.static voidwrite(@NotNull Table table, @NotNull TableDefinition definition, @NotNull ParquetInstructions writeInstructions, @NotNull String path, @NotNull Map<String, String> tableMeta) Writes a table in parquet format under a given pathstatic voidwrite(@NotNull Table table, @NotNull TableDefinition definition, @NotNull ParquetInstructions writeInstructions, @NotNull String path, @NotNull Map<String, String> tableMeta, TableInfo.Builder tableInfoBuilder) Writes a table in parquet format under a given pathstatic <DATA_TYPE>
voidwriteColumnSource(@NotNull Map<String, Map<ParquetCacheTags, Object>> computedCache, @NotNull Index tableRowSet, @NotNull RowGroupWriter rowGroupWriter, @NotNull String name, @NotNull ColumnSource<DATA_TYPE> columnSourceIn, @NotNull ColumnDefinition<DATA_TYPE> columnDefinition, @NotNull 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 @NotNull Table table, @NotNull @NotNull TableDefinition definition, @NotNull @NotNull ParquetInstructions writeInstructions, @NotNull @NotNull String path, @NotNull @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 @NotNull Table table, @NotNull @NotNull TableDefinition definition, @NotNull @NotNull ParquetInstructions writeInstructions, @NotNull @NotNull String path, @NotNull @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 @NotNull Table table, @NotNull @NotNull TableDefinition definition, @NotNull @NotNull ParquetInstructions writeInstructions, @NotNull @NotNull ParquetFileWriter parquetFileWriter, @NotNull @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 newLivenessScopeto 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 @NotNull Table pretransformTable(@NotNull @NotNull Table table, @NotNull @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 @NotNull ParquetFileWriter getParquetFileWriter(@NotNull @NotNull Map<String, Map<ParquetCacheTags, throws IOExceptionObject>> computedCache, @NotNull @NotNull TableDefinition definition, @NotNull @NotNull ReadOnlyIndex tableRowSet, @NotNull @NotNull Map<String, ? extends ColumnSource> columnSourceMap, @NotNull @NotNull String path, @NotNull @NotNull ParquetInstructions writeInstructions, @NotNull @NotNull Map<String, String> tableMeta, @NotNull TableInfo.Builder tableInfoBuilder) Create aParquetFileWriterfor 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 @NotNull Map<String, Map<ParquetCacheTags, throws IllegalAccessException, IOExceptionObject>> computedCache, @NotNull @NotNull Index tableRowSet, @NotNull @NotNull RowGroupWriter rowGroupWriter, @NotNull @NotNull String name, @NotNull @NotNull ColumnSource<DATA_TYPE> columnSourceIn, @NotNull @NotNull ColumnDefinition<DATA_TYPE> columnDefinition, @NotNull @NotNull ParquetInstructions writeInstructions) - Throws:
IllegalAccessExceptionIOException
-