parquet_read_qc Derived Type

type, public :: parquet_read_qc

Read-time quality control declared in CODE rather than in a MAML file: one column per %add call, in exactly the compact "col, min, max, miss" string parquet_schema%add_col_qc already takes, so there is one read-time-QC grammar in this library rather than two. See "Building a qc-maml in code" in doc/pages/schema/quality-control.md for the field syntax -- the operator prefixes (>, >=, <, <=) and the Null/NA/empty miss: convention are inherited from %add_col_qc verbatim.

type(parquet_read_qc) :: qc
call qc%add("mass, >0, <=1000, Null")
call qc%add("flag, , , NA")

Why this exists alongside %add_col_qc, which can already declare the same thing: %add_col_qc emits MAML text into a schema immediately, whereas a caller composing a read may need to hold its declarations UNRESOLVED -- so that the column names can be translated, and the declarations weighed against a MAML's own, only once the file is known. parquet_table is the motivating case; parquet_compose_read_qc is where the two sources are merged.

Entries are unvalidated here -- exactly like parquet_filter%add and parquet_sortkey%add, every check happens when the entry is actually composed into a schema.


Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: entries(:)

Raw, unvalidated entry text, one per %add call. Deferred-length: every entry shares the length of the longest added so far, the same way parquet_filter%rules does.

integer, public :: n = 0

Number of entries actually in use.


Type-Bound Procedures

procedure, public :: add => parquet_read_qc_add

Appends one "col, min, max, miss" declaration.

  • private subroutine parquet_read_qc_add(this, entry)

    Appends one read-time QC declaration; see parquet_read_qc's own doc comment for the "col, min, max, miss" grammar, which is parquet_schema%add_col_qc's verbatim. Unvalidated here -- every check happens in parquet_compose_read_qc, where the entry becomes a real schema. The stored text is deferred-length, exactly as parquet_filter%add's is.

    Arguments

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

    qc declarations gaining one entry.

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

    compact "col, min, max, miss" string.

procedure, public :: remap_column_names => parquet_read_qc_remap_column_names

Renames the column each entry declares, in place: from(k) becomes to(k).

  • interface

    private module subroutine parquet_read_qc_remap_column_names(this, from, to)

    Rewrites the column each qc entry declares, replacing name from(k) with to(k). Backs parquet_read_qc%remap_column_names -- see that binding for what it is for. Only the entry's first (column-name) field is touched; its bounds are carried across verbatim.

    Arguments

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

    qc declarations rewritten in place.

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

    names to replace; same size as to.

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

    replacement for each entry of from.

Source Code

    type parquet_read_qc
        !> Raw, unvalidated entry text, one per %add call. Deferred-length: every entry shares the
        !! length of the longest added so far, the same way parquet_filter%rules does.
        character(len=:), allocatable :: entries(:)
        integer :: n = 0 !! Number of entries actually in use.
    contains
        procedure :: add => parquet_read_qc_add !! Appends one "col, min, max, miss" declaration.
        !> Renames the column each entry declares, in place: `from(k)` becomes `to(k)`.
        procedure :: remap_column_names => parquet_read_qc_remap_column_names
    end type parquet_read_qc