Bundles a parsed MAML source together with the column schema (cinfo) and table metadata (metadata) that parquet_parse_maml derives from it, so a single variable carries everything parquet_open_writer needs. %cinfo and %metadata are public: their fields (col(:), items(:)) and own type-bound procedures stay directly reachable, and the procedures below are flat convenience passthroughs (schema%set_column_available("id") instead of schema%cinfo%set_column_available("id")).
On the read side a qc-maml is populated into %maml alone -- either by parquet_load_qc_maml_file or schema%add_col_qc -- and is never run through parquet_parse_maml (a qc-maml has no data_type and would fail the full schema validation), so %cinfo/%metadata stay empty; parquet_open_reader consumes only %maml.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(parquet_maml_file), | public | :: | maml |
Raw MAML source plus (once parsed) missing-columns/col_map. |
|||
| type(parquet_column_info), | public | :: | cinfo |
Per-field schema/QC state, derived from %maml by parquet_parse_maml. |
|||
| type(parquet_table_metadata), | public | :: | metadata |
Flat key-value table metadata, derived from %maml's keyarray:. |
Overrides the default structure constructor so a schema can be built in one expression (my_maml = parquet_schema(table="my_table")) as an alternative to call my_maml%init(table="my_table"); both call parquet_schema_new/schema_init under the hood. table is the only required argument (the MAML table: key); survey, dataset, version, date, author, description, license, and maml_version are all optional and set the correspondingly-named MAML header key when given. Returns the newly initialized schema.
Initializes a from-scratch schema (table: key + optional metadata).
Initializes a from-scratch parquet_schema: sets the (required) table: key and any of the optional scalar top-level MAML keys given, and marks this schema ready for %add_field. Error stops if this schema is already initialized (this%is_init() == .true., whether from an earlier %init call or a MAML parse -- e.g. calling %init on a schema already loaded via parquet_parse_maml), unless force=.true. is given (see below). List-shaped top-level sections (coauthors:, comments:, keywords:, DOIs:, depends:, keyarray:, extra:) are out of scope here -- keyarray: already has its own API (add_metadata); the others aren't supported by %init/%add_field at all yet.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(inout) | :: | this |
schema being initialized (must not already be initialized, unless force=.true.). |
||
| character(len=*), | intent(in) | :: | table |
required table: key. |
||
| character(len=*), | intent(in), | optional | :: | survey |
optional survey: key. |
|
| character(len=*), | intent(in), | optional | :: | dataset |
optional dataset: key. |
|
| character(len=*), | intent(in), | optional | :: | version |
optional version: key. |
|
| character(len=*), | intent(in), | optional | :: | date |
optional date: key. |
|
| character(len=*), | intent(in), | optional | :: | author |
optional author: key. |
|
| character(len=*), | intent(in), | optional | :: | description |
optional description: key. |
|
| character(len=*), | intent(in), | optional | :: | license |
optional license: key. |
|
| character(len=*), | intent(in), | optional | :: | maml_version |
optional MAML_version: key. |
|
| logical, | intent(in), | optional | :: | force |
if .true., bypass the "already initialized" error stop and fully reset this schema (discarding any fields/qc/metadata already added, and %cinfo/%metadata if %parquet_parse_maml had already run) before re-initializing, as if %init were being called for the first time (default .false.). |
Whether this schema is ready to use (via %init or a MAML parse).
Whether this schema is ready to use -- .true. once either %init/parquet_schema(...) has completed (the in-code builder path) or parquet_parse_maml has populated %cinfo (a schema loaded from a .maml file/object, which never calls %init at all); .false. only for a just-declared parquet_schema that has had neither happen yet. Note %add_field's own "call schema%init(...) before adding fields" guard checks %init having been called specifically, not this broader readiness -- %add_field only makes sense on a from-scratch schema, so it is not satisfied merely by is_init() being .true. via a MAML parse.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(in) | :: | this |
schema to query. |
Whether %cinfo has actually been populated by parquet_parse_maml.
Whether %cinfo has actually been populated by parquet_parse_maml -- .true. only once a parse has run (from a .maml file/object, or via %init/%add_field followed by parquet_parse_maml on the same schema), .false. otherwise, including for a from-scratch schema that has only had %init/%add_field called and never been parsed. This is the readiness check %print_schema_info itself requires (it error stops if %cinfo is unpopulated, unless allow_uninitialized=.true. is given) -- %is_init() is not equivalent here, since %is_init() is already .true. after %init alone, before any parse. Since %is_parsed() == .true. implies %cinfo%col is allocated, which itself already implies %is_init() == .true., %is_parsed() is always .false. whenever %is_init() is .false.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(in) | :: | this |
schema to query. |
Resets the entire schema back to its pristine, just-declared (never-initialized) state.
Resets this schema to exactly the state a freshly declared, never-initialized parquet_schema starts in: %maml/%cinfo/%metadata all back to their defaults (no lines, no fields, no metadata items) and is_init() == .false. again. Unlike %init(..., force=.true.) (which resets and immediately rebuilds with new header-key arguments), %clear leaves the schema uninitialized -- call %init again afterward to reuse the variable, or let it go out of scope. Always succeeds, even on an already-blank schema (a no-op in that case).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(inout) | :: | this |
schema being reset to its pristine state. |
Appends one fields: entry to a from-scratch schema.
Appends one fields: entry to a schema built from scratch (%init must be called first). name/data_type are required (data_type must be one of the supported types); unit/info/ucd/array_size/ col_size and qc_min/qc_max/qc_miss are optional, the latter three forming an optional qc: sub-block (same min:/max: operator-direction and miss: Null/NA rules %add_col_qc enforces, checked independently here -- %add_field is a distinct API from %add_col_qc, not built on top of it: %add_col_qc is for read-time qc-mamls (name + qc: only, no data_type) and explicitly rejects a column already declared as a field, so it cannot be layered onto a field %add_field just added). Validates eagerly (name/data_type/duplicate/qc all checked here, not deferred to parquet_validate_maml).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(inout) | :: | this |
schema being built (%init must have been called first). |
||
| character(len=*), | intent(in) | :: | name |
field name. |
||
| character(len=*), | intent(in) | :: | data_type |
field's data type (must be one of the supported types). |
||
| character(len=*), | intent(in), | optional | :: | unit |
unit of measurement. |
|
| character(len=*), | intent(in), | optional | :: | info |
short description. |
|
| character(len=*), | intent(in), | optional | :: | ucd |
IVOA Unified Content Descriptor. |
|
| integer, | intent(in), | optional | :: | array_size |
maximum string length (string fields only). |
|
| integer, | intent(in), | optional | :: | col_size |
vector-column element count. |
|
| character(len=*), | intent(in), | optional | :: | qc_min |
qc: min: bound (operator prefix allowed). |
|
| character(len=*), | intent(in), | optional | :: | qc_max |
qc: max: bound (operator prefix allowed). |
|
| character(len=*), | intent(in), | optional | :: | qc_miss |
Sets qc: miss:. Absent means no miss: is declared, i.e. nothing is said about Nulls and none are checked. An explicit EMPTY string declares that Nulls are NOT expected and turns Null validation on. "Null"/"NA" (case-insensitive) declares that they are expected. Presence, not content, is what is tested -- see parquet_column_type%qc_allow_null. |
Copies one field's definition from another (already-parsed) schema and appends it here via %add_field.
Copies name's full field definition from source_schema (via %get_field) and
appends an equivalent field here via %add_field -- so two schemas can share a column
definition (e.g. a handful of "identity" columns common to several output tables)
without the caller re-typing its type/unit/info/qc by hand and risking drift between
the copies. source_schema must already be parsed (see %get_field); this must
already have %init called, exactly like a direct %add_field call would require.
Subject to the same qc_min/qc_max/qc_miss round-trip caveats as %get_field: the copy
is semantically equivalent to the source field, not necessarily a byte-identical MAML
re-declaration.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(inout) | :: | this |
schema gaining the copied field (%init already called). |
||
| type(parquet_schema), | intent(in) | :: | source_schema |
already-parsed schema to copy |
||
| character(len=*), | intent(in) | :: | name |
name of the field to copy (looked up in source_schema). |
Enables a column, or every column if no name is given.
Forwards to %cinfo%set_column_available; enables name, or every
non-deactivated column if name is absent.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(inout) | :: | this |
schema whose cinfo is updated. |
||
| character(len=*), | intent(in), | optional | :: | name |
column to enable; every column if absent. |
Disables a column, or every column if no name is given.
Forwards to %cinfo%set_column_unavailable; disables name, or
every non-deactivated column if name is absent.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(inout) | :: | this |
schema whose cinfo is updated. |
||
| character(len=*), | intent(in), | optional | :: | name |
column to disable; every column if absent. |
Resolves a column's col_size before parquet_open_writer.
Forwards to %cinfo%set_col_size.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(inout) | :: | this |
schema whose cinfo is updated. |
||
| character(len=*), | intent(in) | :: | name |
column to resolve. |
||
| integer, | intent(in) | :: | col_size |
new col_size (must be a positive integer). |
||
| logical, | intent(in), | optional | :: | force |
.true. allows overriding a col_size that isn't currently "auto" (default .false.: only an "auto" col_size may be resolved this way). |
Marks/unmarks a column Null-protected.
Forwards to %cinfo%set_protected.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(inout) | :: | this |
schema whose cinfo is updated. |
||
| character(len=*), | intent(in) | :: | name |
column to mark (internal name, as declared). |
||
| logical, | intent(in), | optional | :: | protected |
.false. to unprotect; default .true. |
Resolves a string column's array_size before parquet_open_writer.
Forwards to %cinfo%set_array_size.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(inout) | :: | this |
schema whose cinfo is updated. |
||
| character(len=*), | intent(in) | :: | name |
string column to resolve. |
||
| integer, | intent(in) | :: | array_size |
new array_size (must be a positive integer). |
||
| logical, | intent(in), | optional | :: | force |
.true. allows overriding an array_size that isn't currently "auto" (default .false.: only an "auto" array_size may be resolved this way). |
1-based index of a column by name; error stops if not found.
Forwards to %cinfo%get_column_index.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(in) | :: | this |
schema to search. |
||
| character(len=*), | intent(in) | :: | name |
column name to look up. |
Whether a column is currently enabled to be written; error stops if not found.
Forwards to %cinfo%is_column_set.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(in) | :: | this |
schema to search. |
||
| character(len=*), | intent(in) | :: | name |
column name to look up. |
Total number of declared fields.
Forwards to %cinfo%get_num_fields.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(in) | :: | this |
schema to query. |
Field name at a given 1-based MAML source position.
Forwards to %cinfo%get_field_name.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(in) | :: | this |
schema to query. |
||
| integer, | intent(in) | :: | index |
1-based field position in MAML source order. |
||
| character(len=:), | intent(out), | allocatable | :: | name |
field name at that position. |
Full field definition by name; error stops if not found.
Forwards to %cinfo%get_field_by_name -- see that procedure's own doc comment (parquet_column_info's spec, above) for the full contract, including the qc_min/ qc_max/qc_miss round-trip caveats and the "schema must already be parsed" precondition.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(in) | :: | this |
schema to query. |
||
| character(len=*), | intent(in) | :: | name |
field name to look up. |
||
| character(len=:), | intent(out), | optional, | allocatable | :: | data_type |
field's data type. |
| character(len=:), | intent(out), | optional, | allocatable | :: | unit |
unit of measurement, if declared. |
| character(len=:), | intent(out), | optional, | allocatable | :: | info |
short description, if declared. |
| character(len=:), | intent(out), | optional, | allocatable | :: | ucd |
IVOA Unified Content Descriptor, if declared. |
| integer, | intent(out), | optional | :: | array_size |
maximum string length (string fields only). |
|
| integer, | intent(out), | optional | :: | col_size |
vector-column element count. |
|
| character(len=:), | intent(out), | optional, | allocatable | :: | qc_min |
Reconstructed qc: min: bound, operator-prefixed; empty if none was declared. |
| character(len=:), | intent(out), | optional, | allocatable | :: | qc_max |
Reconstructed qc: max: bound, operator-prefixed; empty if none was declared. |
| character(len=:), | intent(out), | optional, | allocatable | :: | qc_miss |
"Null" if this field allows Nulls (declared miss: Null/NA, or no miss: at all), else "" for the explicit empty miss: that asks for Null validation. |
Full field definition by 1-based MAML source position.
Forwards to %cinfo%get_field_by_index -- see get_field_by_name above for the full
per-argument contract; the only difference is the lookup key (1-based MAML source
position instead of name) and that name itself is returned (not optional, since the
caller doesn't already know it).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(in) | :: | this |
schema to query. |
||
| integer, | intent(in) | :: | index |
1-based field position in MAML source order. |
||
| character(len=:), | intent(out), | allocatable | :: | name |
field name at that position. |
|
| character(len=:), | intent(out), | optional, | allocatable | :: | data_type |
field's data type. |
| character(len=:), | intent(out), | optional, | allocatable | :: | unit |
unit of measurement, if declared. |
| character(len=:), | intent(out), | optional, | allocatable | :: | info |
short description, if declared. |
| character(len=:), | intent(out), | optional, | allocatable | :: | ucd |
IVOA Unified Content Descriptor, if declared. |
| integer, | intent(out), | optional | :: | array_size |
maximum string length (string fields only). |
|
| integer, | intent(out), | optional | :: | col_size |
vector-column element count. |
|
| character(len=:), | intent(out), | optional, | allocatable | :: | qc_min |
Reconstructed qc: min: bound, operator-prefixed; empty if none was declared. |
| character(len=:), | intent(out), | optional, | allocatable | :: | qc_max |
Reconstructed qc: max: bound, operator-prefixed; empty if none was declared. |
| character(len=:), | intent(out), | optional, | allocatable | :: | qc_miss |
"Null" if this field allows Nulls (declared miss: Null/NA, or no miss: at all), else "" for the explicit empty miss: that asks for Null validation. |
Reads back a field's full, add_field-equivalent definition, by name or by 1-based source position; forwards to %cinfo%get_field.
Writes a "Table name:" line plus an aligned name/unit/type/len/ucd/info listing of enabled (is_set) columns to a unit/file.
Writes a fixed-width, aligned listing of this schema's enabled (is_set) columns, one per output line, in the order name/unit/data_type/col_size/ucd/info -- the last (info) column is left unpadded so no line carries trailing whitespace. Column widths are derived from the longest value actually present across the enabled columns (and, when header=.true., the header label itself), so each call produces its own self-contained, internally-aligned block; two calls for different schemas are not aligned with each other. Exactly one of unit/filename must identify the destination: unit (an already-open unit, e.g. opened once by the caller and reused across several schemas' worth of calls to build up one combined listing) or filename (opened here with position="append", written, and closed again before returning). Giving neither, or an unopened/read-only unit, or a unit+filename pair where filename does not match (exact, trimmed string equality against inquire(unit=unit, name=)) the file unit is already connected to, all error stop. Calling this on a schema that has not been parsed yet (schema%cinfo not populated -- neither parquet_parse_maml nor, for an in-code schema, %init/%add_field followed by parquet_parse_maml, has run) also error stops by default, with the message "schema is not initialized (not parsed)" -- pass allow_uninitialized=.true. to silently print nothing instead (a complete no-op: no file is opened/touched, even in filename= mode) rather than aborting. Use schema%is_parsed() to check readiness before calling, rather than schema%is_init(): a from-scratch schema that has only had %init/%add_field called (never parsed) has is_init() == .true. but is_parsed() == .false., and would still error stop here. Conversely, a schema loaded via parquet_parse_maml (from a file or an already-populated object) is fully valid here even though it never calls %init -- is_parsed() == .true. covers that case too.
| Type | Intent | Optional | Attributes | Name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class(parquet_schema), | intent(in) | :: | this |
schema whose enabled (is_set) columns are listed. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| integer, | intent(in), | optional | :: | unit |
already-open unit to write to (see filename for the alternative). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| character(len=*), | intent(in), | optional | :: | filename |
output path; opened with position="append" if unit absent. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| character(len=*), | intent(in), | optional | :: | prefix |
prepended to every emitted line (default: none). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logical, | intent(in), | optional | :: | header |
print a "name unit type len ucd info" header row (default .true.). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logical, | intent(in), | optional | :: | table_name |
print a "Table name:
procedure, public :: add_col_qc => schema_add_col_qcAppends one qc: field entry from a compact string.
procedure, public :: set_col_qc => schema_set_col_qcIn-place form of %add_col_qc; parses the name into its argument.
procedure, public :: schema_add_metadata_int32int32 specific.
procedure, public :: schema_add_metadata_int64int64 specific.
procedure, public :: schema_add_metadata_float32float32 specific.
procedure, public :: schema_add_metadata_float64float64 specific.
procedure, public :: schema_add_metadata_logicallogical specific.
procedure, public :: schema_add_metadata_stringstring specific.
procedure, public :: schema_add_metadata_int32_arrayint32 array specific.
procedure, public :: schema_add_metadata_int64_arrayint64 array specific.
procedure, public :: schema_add_metadata_float32_arrayfloat32 array specific.
procedure, public :: schema_add_metadata_float64_arrayfloat64 array specific.
procedure, public :: schema_add_metadata_logical_arraylogical array specific.
procedure, public :: schema_add_metadata_string_arraystring array specific.
generic, public :: add_metadata => schema_add_metadata_int32, schema_add_metadata_int64, schema_add_metadata_float32, schema_add_metadata_float64, schema_add_metadata_logical, schema_add_metadata_string, schema_add_metadata_int32_array, schema_add_metadata_int64_array, schema_add_metadata_float32_array, schema_add_metadata_float64_array, schema_add_metadata_logical_array, schema_add_metadata_string_arrayAppends one flat key-value metadata entry; dispatched by value's type/kind/rank.
procedure, public :: clear_metadata => schema_clear_metadataForwards to %metadata%clear_metadata.
Source Codetype parquet_schema type(parquet_maml_file) :: maml !! Raw MAML source plus (once parsed) missing-columns/col_map. type(parquet_column_info) :: cinfo !! Per-field schema/QC state, derived from %maml by parquet_parse_maml. type(parquet_table_metadata) :: metadata !! Flat key-value table metadata, derived from %maml's keyarray:. !> Set by %init: guards %add_field, which otherwise has no "fields:" !> header (or even a %maml at all) to append to. Only %init and !> %add_field are meaningful for a schema being built from scratch in !> memory -- a schema populated via parquet_parse_maml (from a real !> MAML file/object) never calls %init and never needs %add_field. logical, private :: is_initialized = .false. contains procedure :: init => schema_init !! Initializes a from-scratch schema (table: key + optional metadata). procedure :: is_init => schema_is_init !! Whether this schema is ready to use (via %init or a MAML parse). procedure :: is_parsed => schema_is_parsed !! Whether %cinfo has actually been populated by parquet_parse_maml. procedure :: clear => schema_clear !! Resets the entire schema back to its pristine, !! just-declared (never-initialized) state. procedure :: add_field => schema_add_field !! Appends one fields: entry to a from-scratch schema. procedure :: add_field_from => schema_add_field_from !! Copies one field's definition from another !! (already-parsed) schema and appends it here via %add_field. procedure :: set_column_available !! Enables a column, or every column if no name is given. procedure :: set_column_unavailable !! Disables a column, or every column if no name is given. procedure :: set_col_size => schema_set_col_size !! Resolves a column's col_size before parquet_open_writer. procedure :: set_protected => schema_set_protected !! Marks/unmarks a column Null-protected. procedure :: set_array_size => schema_set_array_size !! Resolves a string column's array_size before !! parquet_open_writer. procedure :: get_column_index => schema_get_column_index !! 1-based index of a column by !! name; error stops if not found. procedure :: is_column_set => schema_is_column_set !! Whether a column is currently enabled to be !! written; error stops if not found. procedure :: get_num_fields => schema_get_num_fields !! Total number of declared fields. procedure :: get_field_name => schema_get_field_name !! Field name at a given 1-based MAML source position. procedure :: get_field_by_name => schema_get_field_by_name !! Full field definition by name; error !! stops if not found. procedure :: get_field_by_index => schema_get_field_by_index !! Full field definition by 1-based !! MAML source position. generic :: get_field => get_field_by_name, get_field_by_index !! Reads back a field's full, !! add_field-equivalent definition, by name or by 1-based source position; forwards to %cinfo%get_field. procedure :: print_schema_info => schema_print_schema_info !! Writes a "Table name:" line plus an aligned !! name/unit/type/len/ucd/info listing of enabled (is_set) columns to a unit/file. ! add_col_qc/set_col_qc build a read-time qc-maml. Two intentional ! naming choices here: (1) "col_qc" is a deliberate domain abbreviation ! for "column quality-control" (the qc: block of a fields: entry) -- ! kept short because it appears in every qc-building call. (2) set_col_qc ! is named set_ (not get_) precisely because it MUTATES the schema (it ! appends the entry, like add_col_qc): the set_ form exists so a caller ! can reuse one variable in place (call schema%set_col_qc(col) -- col holds ! the qc_input string on entry, the parsed column name on exit) instead of ! separately naming an input and an output variable the way add_col_qc's ! optional col_name argument requires. It is a builder that also returns ! the name, not a pure query -- and, being a subroutine, never returns ! character(len=:), allocatable as a function result (see "Build and ! compiler notes" in CLAUDE.md for why that matters). procedure :: add_col_qc => schema_add_col_qc !! Appends one qc: field entry from a compact string. procedure :: set_col_qc => schema_set_col_qc !! In-place form of %add_col_qc; parses the name into its argument. procedure :: schema_add_metadata_int32 !! int32 specific. procedure :: schema_add_metadata_int64 !! int64 specific. procedure :: schema_add_metadata_float32 !! float32 specific. procedure :: schema_add_metadata_float64 !! float64 specific. procedure :: schema_add_metadata_logical !! logical specific. procedure :: schema_add_metadata_string !! string specific. procedure :: schema_add_metadata_int32_array !! int32 array specific. procedure :: schema_add_metadata_int64_array !! int64 array specific. procedure :: schema_add_metadata_float32_array !! float32 array specific. procedure :: schema_add_metadata_float64_array !! float64 array specific. procedure :: schema_add_metadata_logical_array !! logical array specific. procedure :: schema_add_metadata_string_array !! string array specific. !> Appends one flat key-value metadata entry; dispatched by value's type/kind/rank. generic :: add_metadata => schema_add_metadata_int32, schema_add_metadata_int64, & schema_add_metadata_float32, schema_add_metadata_float64, & schema_add_metadata_logical, schema_add_metadata_string, & schema_add_metadata_int32_array, schema_add_metadata_int64_array, & schema_add_metadata_float32_array, schema_add_metadata_float64_array, & schema_add_metadata_logical_array, schema_add_metadata_string_array procedure :: clear_metadata => schema_clear_metadata !! Forwards to %metadata%clear_metadata. end type parquet_schema |