writeTable

The writeTable method will write a table to a standard Parquet file.

Syntax

Note

To write multiple tables at once, use writeTables:

Parameters

ParameterTypeDescription
sourceTableTable

The table to write to file.

destPathString

Path name or URI of the file where the table will be stored. The file name should end with the .parquet extension. If the path includes non-existing directories, they are created. If there is an error, any intermediate directories previously created are removed; note this makes this method unsafe for concurrent use.

writeInstructions optionalParquetInstructions

Instructions for customizations while writing. For simple compression, use predefined constants:

  • ParquetTools.SNAPPY: Aims for high speed, and a reasonable amount of compression, based on Snappy compression format by Google.
  • ParquetTools.UNCOMPRESSED: The output will not be compressed.
  • ParquetTools.LZ4_RAW: A codec based on the LZ4 block format. Should always be used instead of LZ4.
  • ParquetTools.LZ4: Deprecated Use LZ4_RAW instead.
  • ParquetTools.LZO: Compression codec based on or interoperable with the LZO compression library.
  • ParquetTools.GZIP: Compression codec based on the GZIP format defined by RFC 1952.
  • ParquetTools.ZSTD: Compression codec with a high compression ratio based on the Zstandard format defined by RFC 8478.
  • ParquetTools.BROTLI: Compression codec based on Brotli, offering high compression ratios.

If not specified, defaults to SNAPPY.

For advanced options such as Row Group configuration, metadata file generation, index columns, and S3 support, use ParquetInstructions.builder(). See the Parquet instructions guide for details.

Returns

A Parquet file located in the specified path.

Examples

Note

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.

Compression codec

In this example, writeTable writes the source table /data/output_GZIP.parquet with GZIP compression.