| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_table), | intent(in) | :: | table |
the table to write (any extending type too). |
||
| character(len=*), | intent(in) | :: | filename |
output parquet file. |
||
| type(parquet_schema), | intent(inout), | optional | :: | schema |
output schema; absent = schema-less write. |
|
| logical, | intent(in), | optional | :: | row_mask(:) |
per-row write mask. |
|
| logical, | intent(in), | optional | :: | copy_metadata |
.true.: carry every source-file metadata entry. |
|
| character(len=*), | intent(in), | optional | :: | metadata_keys(:) |
carry only these source-file keys. |
|
| logical, | intent(in), | optional | :: | write_maml |
also save a sidecar .maml next to filename. |
|
| logical, | intent(in), | optional | :: | qc |
run the schema's qc: checks on write; defaults to on. |
|
| character(len=*), | intent(in), | optional | :: | compression |
Arrow compression codec name (e.g. "snappy"). |
|
| integer, | intent(in), | optional | :: | compression_level |
codec-specific compression level. |
|
| integer, | intent(in), | optional | :: | chunk_size |
Parquet row-group size, in rows. |
|
| logical, | intent(in), | optional | :: | use_threads |
use Arrow's multi-threaded writer. |
|
| logical, | intent(in), | optional | :: | overwrite |
allow truncating an existing file; default .true. |
|
| logical, | intent(in), | optional | :: | release |
evict columns this write materialized; default .true. |
Writes table to filename using schema to choose and name the output columns:
every enabled schema field is looked up in the table BY ITS INTERNAL NAME, and written
under its own output name (a col_map: rename is honoured automatically). A schema field
with no matching table column is an error; a table column the schema does not name is
simply not written. row_mask writes a row subset without changing the table.
schema is optional. Without one the write is schema-less: every column that is
currently RESIDENT is written, in slot order, under its own internal name -- a quick
path for a small or temporary table that reads nothing and needs no schema built for
it. A table with nothing resident writes a valid empty file. The automatic
parquet_row_index column is never written by a schema-less write, even when it is
resident; name it in a schema to write it. Without a schema there is no col_map: and
no qc:, so output names are the internal names and writer-side qc is off.
A schema built with %init/%add_field and never parsed is parsed here, so calling
parquet_parse_maml first is optional. That is why schema is intent(inout): the
caller's schema is parsed on return.
copy_metadata=.true. carries every key/value metadata entry of the table's SOURCE FILE
into the output; metadata_keys= carries only the listed keys (and error stops on one
the source does not have). The two are mutually exclusive. A key the schema itself
declares wins and is not overwritten -- the schema is the explicit statement. Both work
after the table has detached, since the metadata was snapshotted at open, and neither
adds anything to the caller's own schema.
write_maml, qc, compression, compression_level, chunk_size, use_threads and
overwrite are pass-throughs to parquet_open_writer with its own defaults and no
reinterpretation, so a table write and the equivalent hand-written open stay the same
calls. chunk_size is default-kind integer on purpose: a row group cannot hold more
than int32 rows, so there is no int64 form to add.
release (default .true.) leaves the table in the residency state it started in: a
column this write had to materialize is evicted again once it has been written, while a
column the caller had already read is left alone. Releasing frees storage a %col
pointer could alias, so the generation counter advances when at least one column was
actually released -- possibly a false alarm (nothing you can hold a pointer to is ever
released), never a missed one.