writeTable
The writeTable
method will write a table to a standard Parquet file.
Syntax
writeTable(sourceTable, destPath)
writeTable(sourceTable, destFile)
writeTable(sourceTable, destFile, definition)
writeTable(sourceTable, destFile, writeInstructions)
writeTable(sourceTable, destPath, definition, writeInstructions)
writeTable(sourceTable, destFile, definition, writeInstructions)
Parameters
Parameter | Type | Description |
---|---|---|
sourceTable | Table | The table to write to file. |
destPath | String | Path name of the file where the table will be stored. The file name should end with the |
destFile | File | Destination file. Its path must end in ".parquet". Any non-existing directories in the path are created. If there is an error, any intermediate directories previously created are removed. Note: this makes this method unsafe for concurrent use. |
definition | TableDefinition | Table definition to use (instead of the one implied by the table itself). |
writeInstructions | ParquetInstructions | Instructions for customizations while writing. Valid values are:
If not specified, defaults to |
Returns
A Parquet file located in the specified path.
Examples
All examples in this document write data to the /data
directory in Deephaven. For more information on this directory and how it relates to your local file system, see Docker data volumes.
Single Parquet file
In this example, writeTable
writes the source table to /data/output.parquet
.
import io.deephaven.parquet.table.ParquetTools
source = newTable(
stringCol("X", "A", "B", "B", "C", "B", "A", "B", "B", "C"),
intCol("Y",2, 4, 2, 1, 2, 3, 4, 2, 3),
intCol("Z", 55, 76, 20, 4, 230, 50, 73, 137, 214),
)
ParquetTools.writeTable(source, "/data/output.parquet")
- source
Compression codec
In this example, writeTable
writes the source table /data/output_GZIP.parquet
with GZIP
compression.
import io.deephaven.parquet.table.ParquetTools
source = newTable(
stringCol("X", "A", "B", "B", "C", "B", "A", "B", "B", "C"),
intCol("Y",2, 4, 2, 1, 2, 3, 4, 2, 3),
intCol("Z", 55, 76, 20, 4, 230, 50, 73, 137, 214),
)
ParquetTools.writeTable(source, "/data/output_GZIP.parquet", ParquetTools.GZIP)
- source