parquet_column_info Derived Type

type, public :: parquet_column_info

Column-level schema state for one MAML: an array of parquet_column_type, one per declared field, plus lookups/toggles over it. Embedded in parquet_schema%cinfo; parquet_schema's own type-bound procedures are flat passthroughs to the ones here.


Components

Type Visibility Attributes Name Initial
type(parquet_column_type), public, allocatable :: col(:)

One entry per declared field, in MAML source order.


Type-Bound Procedures

procedure, public :: get_column_index

1-based index of a column by name; error stops if not found.

  • interface

    private module function get_column_index(this, name)

    1-based index of name in this%col; error stops if name is not found.

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_column_info), intent(in) :: this

    column_info to search.

    character(len=*), intent(in) :: name

    column name to look up.

    Return Value integer

procedure, public :: is_column_set

Whether a column is currently enabled to be written; error stops if not found.

  • interface

    private module function is_column_set(this, name)

    Whether name is currently enabled to be written (its col(:)%is_set); error stops if name is not found (via get_column_index).

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_column_info), intent(in) :: this

    column_info to search.

    character(len=*), intent(in) :: name

    column name to look up.

    Return Value logical

procedure, public :: get_num_fields

Total number of declared fields.

  • interface

    private module function get_num_fields(this)

    Total number of fields defined in this column_info, in maml source order, with no filtering by is_set/is_deactivated -- i.e. every field that was ever declared (via a fields: entry or %add_field).

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_column_info), intent(in) :: this

    column_info to query.

    Return Value integer

procedure, public :: get_field_name

Field name at a given 1-based MAML source position.

  • interface

    private module subroutine get_field_name(this, index, name)

    Name of the field at the given 1-based position in maml source order (same order get_num_fields counts). index must be between 1 and get_num_fields(this); anything outside that range fails with error stop.

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_column_info), intent(in) :: this

    column_info 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.

procedure, public :: get_field_by_name

Full field definition by name; error stops if not found.

  • interface

    private module subroutine get_field_by_name(this, name, data_type, unit, info, ucd, array_size, col_size, qc_min, qc_max, qc_miss)

    Reads back name's full field definition -- the same shape of values %add_field accepts, so a caller can inspect an already-parsed schema's columns or feed the result straight into another schema's %add_field (see %add_field_from, parquet_schema's own convenience wrapper built on top of this). Every output is optional/intent(out); pass only the ones you need. qc_min/qc_max are reconstructed as a single operator-prefixed string (e.g. ">= 5.0"), re-feedable into %add_field's own qc_min/qc_max arguments -- note this always carries an explicit operator, even if the original %add_field call left it implicit (">=" for min, "<=" for max), which is semantically identical but not necessarily byte-identical to the original input. qc_miss comes back as "Null" or "" (never "NA", even if that's what was originally declared -- both are equivalent aliases and the distinction isn't preserved in storage). Error stops if name is not found. Assumes this column_info reflects the schema's current fields: parquet_parse_maml (or, for a from-scratch schema, %init/%add_field followed by parquet_parse_maml) must already have run; any %add_field call since the last parse is not yet visible here.

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_column_info), intent(in) :: this

    column_info 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" when this field allows Nulls (a declared qc: miss: Null/NA, or no miss: declared at all -- both mean the same thing), else "" for an explicit empty qc: miss:, which is the one form that asks for Null validation.

procedure, public :: get_field_by_index

Full field definition by 1-based MAML source position.

  • interface

    private module subroutine get_field_by_index(this, index, name, data_type, unit, info, ucd, array_size, col_size, qc_min, qc_max, qc_miss)

    Same as get_field_by_name, but looks the field up by its 1-based MAML source position (same order get_num_fields counts) instead of by name, additionally returning that field's name (always populated, not optional, since the caller doesn't already know it). index must be between 1 and get_num_fields(this); anything outside that range fails with error stop.

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_column_info), intent(in) :: this

    column_info 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" when this field allows Nulls (a declared qc: miss: Null/NA, or no miss: declared at all -- both mean the same thing), else "" for an explicit empty qc: miss:, which is the one form that asks for Null validation.

generic, public :: 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.

  • private interface get_field_by_name()

    Arguments

    None
  • private interface get_field_by_index()

    Arguments

    None

procedure, public :: set_column_unavailable => set_unavailable

Disables a column, or every column if no name is given.

  • interface

    private module subroutine set_unavailable(this, name)

    Backs parquet_schema%set_column_unavailable (see set_column_unavailable in the parquet_schema block above); disables name, or every non-deactivated column if name is absent. Error stops if name is a deactivated column.

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_column_info), intent(inout) :: this

    column_info being updated.

    character(len=*), intent(in), optional :: name

    column to disable; every column if absent.

procedure, public :: set_column_available => set_available

Enables a column, or every column if no name is given.

  • interface

    private module subroutine set_available(this, name)

    Backs parquet_schema%set_column_available; enables name, or every non-deactivated column if name is absent. Error stops if name is a deactivated column.

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_column_info), intent(inout) :: this

    column_info being updated.

    character(len=*), intent(in), optional :: name

    column to enable; every column if absent.

procedure, public :: set_col_size

Resolves a column's col_size (only if currently "auto" unless force=.true.).

  • interface

    private module subroutine set_col_size(this, name, col_size, force)

    Resolves name's col_size to col_size. Error stops if col_size < 1, if name is not found (via get_column_index), or if name's col_size is not currently "auto" and force is absent/.false. (pass force=.true. to override an already-resolved col_size too).

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_column_info), intent(inout) :: this

    column_info being 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 non-"auto" col_size (default .false.).

procedure, public :: set_protected

Marks/unmarks a column Null-protected (extra: protected_cols:).

  • interface

    private module subroutine set_protected(this, name, protected)

    Marks name Null-protected, or (protected=.false.) unmarks it -- the code-level equivalent of listing it under a MAML's extra: protected_cols:. A protected column may hold no Null at all: parquet_write_column error stops on an is_valid mask with any .false. entry, on a null date/time/timestamp element, and on an %append_null() in a parquet_string_column, and the column's Arrow field is written non-nullable.

    Unprotecting a column that is currently protected is allowed -- a program may have a good reason to relax its own schema -- but emits a WARNING naming the column, since it overrides a declaration someone made deliberately. Never an abort. The warning does not depend on where the protection came from: a MAML's extra: protected_cols: and an earlier set_protected call in code are indistinguishable here, and both warn.

    Error stops if name is not found. Call it before parquet_open_writer: the writer takes its copy of the schema at open time, so a later change has no effect on a writer that is already open.

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_column_info), intent(inout) :: this

    column_info being updated.

    character(len=*), intent(in) :: name

    column to mark (internal name, as declared).

    logical, intent(in), optional :: protected

    .false. to unprotect; default .true.

procedure, public :: set_array_size

Resolves a string column's array_size (only if currently "auto" unless force=.true.).

  • interface

    private module subroutine set_array_size(this, name, array_size, force)

    Resolves name's array_size to array_size. Error stops if array_size < 1, if name is not found, if name's data_type is not "string" (array_size only applies to string columns), or if name's array_size is not currently "auto" and force is absent/.false.

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_column_info), intent(inout) :: this

    column_info being 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 a non-"auto" array_size (default .false.).

Source Code

    type parquet_column_info
        type(parquet_column_type), allocatable :: col(:) !! One entry per declared field, in MAML source order.
    contains
        procedure :: get_column_index !! 1-based index of a column by name; error stops if not found.
        procedure :: is_column_set !! Whether a column is currently enabled to be written; error stops if not found.
        procedure :: get_num_fields !! Total number of declared fields.
        procedure :: get_field_name !! Field name at a given 1-based MAML source position.
        procedure :: get_field_by_name !! Full field definition by name; error stops if not found.
        procedure :: 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.
        ! Exposed as set_column_available/set_column_unavailable to match the
        ! same-named methods on parquet_schema (the primary public API); the
        ! backing module procedures keep the shorter set_available/set_unavailable
        ! names only to avoid colliding with parquet_schema's own impls.
        procedure :: set_column_unavailable => set_unavailable !! Disables a column, or every column if no name is given.
        procedure :: set_column_available => set_available !! Enables a column, or every column if no name is given.
        procedure :: set_col_size !! Resolves a column's col_size (only if currently "auto" unless force=.true.).
        procedure :: set_protected !! Marks/unmarks a column Null-protected (extra: protected_cols:).
        procedure :: set_array_size !! Resolves a string column's array_size (only if currently "auto" unless force=.true.).
    end type parquet_column_info