parquet_table_metadata Derived Type

type, public :: parquet_table_metadata

Flat key-value table metadata: one array of parquet_metadata_entry plus the add_metadata family of type-bound procedures that append to it (one specific per supported type/kind, dispatched via the add_metadata generic).


Components

Type Visibility Attributes Name Initial
type(parquet_metadata_entry), public, allocatable :: items(:)

One entry per add_metadata call (or MAML keyarray: item).

character(len=:), public, allocatable :: source_maml_lines(:)

Verbatim source MAML lines, populated by parquet_read_maml; used by parquet_open_writer(..., write_maml=.true.) to save a sidecar .maml file next to the .parquet output. add_metadata calls made after parquet_read_maml append a new keyarray: entry to these lines (see parquet_append_keyarray_line), so the sidecar reflects them; it is NOT kept in sync with which columns end up enabled/written, though.

integer, public :: n_base_items = 0

Count of %items present immediately after the most recent parquet_parse_maml (table:/survey:/... header keys plus any real MAML keyarray: entries) -- the "base" metadata %clear_metadata preserves, discarding only entries appended by %add_metadata calls made after that parse. 0 for a never-parsed table_metadata.


Type-Bound Procedures

procedure, public :: clear_metadata => metadata_clear_metadata

Discards %add_metadata entries added after the most recent parse, keeping the base (header keys + keyarray:) entries.

  • interface

    private module subroutine metadata_clear_metadata(this)

    Truncates %items back to %n_base_items, discarding every entry appended by an %add_metadata call made since the most recent parquet_parse_maml -- a no-op if %items currently holds %n_base_items entries or fewer (nothing to discard).

    Arguments

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

    table metadata being truncated.

procedure, public :: add_metadata_int32

int32 specific.

  • interface

    private module subroutine add_metadata_int32(this, key, value, description, warn)

    int32 specific of parquet_table_metadata%add_metadata; stores value as plain text via parquet_metadata_append_entry.

    Arguments

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

    table metadata gaining one entry.

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

    metadata key.

    integer(kind=int32), intent(in) :: value

    metadata value.

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

    optional free-text description.

    logical, intent(in), optional :: warn

    .false. suppresses the duplicate-key warning (default .true.).

procedure, public :: add_metadata_int64

int64 specific.

  • interface

    private module subroutine add_metadata_int64(this, key, value, description, warn)

    int64 specific of parquet_table_metadata%add_metadata; see add_metadata_int32.

    Arguments

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

    table metadata gaining one entry.

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

    metadata key.

    integer(kind=int64), intent(in) :: value

    metadata value.

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

    optional free-text description.

    logical, intent(in), optional :: warn

    .false. suppresses the duplicate-key warning (default .true.).

procedure, public :: add_metadata_float32

float32 specific.

  • interface

    private module subroutine add_metadata_float32(this, key, value, description, fmt, warn)

    float32 specific of parquet_table_metadata%add_metadata; see add_metadata_int32.

    Arguments

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

    table metadata gaining one entry.

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

    metadata key.

    real(kind=real32), intent(in) :: value

    metadata value.

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

    optional free-text description.

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

    optional Fortran edit descriptor for the stored text.

    logical, intent(in), optional :: warn

    .false. suppresses the duplicate-key warning (default .true.).

procedure, public :: add_metadata_float64

float64 specific.

  • interface

    private module subroutine add_metadata_float64(this, key, value, description, fmt, warn)

    float64 specific of parquet_table_metadata%add_metadata; see add_metadata_int32.

    Arguments

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

    table metadata gaining one entry.

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

    metadata key.

    real(kind=real64), intent(in) :: value

    metadata value.

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

    optional free-text description.

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

    optional Fortran edit descriptor for the stored text.

    logical, intent(in), optional :: warn

    .false. suppresses the duplicate-key warning (default .true.).

procedure, public :: add_metadata_logical

logical specific.

  • interface

    private module subroutine add_metadata_logical(this, key, value, description, warn)

    logical specific of parquet_table_metadata%add_metadata; see add_metadata_int32.

    Arguments

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

    table metadata gaining one entry.

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

    metadata key.

    logical, intent(in) :: value

    metadata value.

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

    optional free-text description.

    logical, intent(in), optional :: warn

    .false. suppresses the duplicate-key warning (default .true.).

procedure, public :: add_metadata_string

string specific.

  • interface

    private module subroutine add_metadata_string(this, key, value, description, warn)

    string specific of parquet_table_metadata%add_metadata; see add_metadata_int32.

    Arguments

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

    table metadata gaining one entry.

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

    metadata key.

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

    metadata value.

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

    optional free-text description.

    logical, intent(in), optional :: warn

    .false. suppresses the duplicate-key warning (default .true.).

procedure, public :: add_metadata_int32_array

int32 array specific.

  • interface

    private module subroutine add_metadata_int32_array(this, key, value, description, warn)

    int32 array specific of parquet_table_metadata%add_metadata; see add_metadata_int32.

    Arguments

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

    table metadata gaining one entry.

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

    metadata key.

    integer(kind=int32), intent(in) :: value(:)

    metadata values.

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

    optional free-text description.

    logical, intent(in), optional :: warn

    .false. suppresses the duplicate-key warning (default .true.).

procedure, public :: add_metadata_int64_array

int64 array specific.

  • interface

    private module subroutine add_metadata_int64_array(this, key, value, description, warn)

    int64 array specific of parquet_table_metadata%add_metadata; see add_metadata_int32.

    Arguments

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

    table metadata gaining one entry.

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

    metadata key.

    integer(kind=int64), intent(in) :: value(:)

    metadata values.

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

    optional free-text description.

    logical, intent(in), optional :: warn

    .false. suppresses the duplicate-key warning (default .true.).

procedure, public :: add_metadata_float32_array

float32 array specific.

  • interface

    private module subroutine add_metadata_float32_array(this, key, value, description, fmt, warn)

    float32 array specific of parquet_table_metadata%add_metadata; see add_metadata_int32.

    Arguments

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

    table metadata gaining one entry.

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

    metadata key.

    real(kind=real32), intent(in) :: value(:)

    metadata values.

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

    optional free-text description.

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

    optional Fortran edit descriptor for the stored text.

    logical, intent(in), optional :: warn

    .false. suppresses the duplicate-key warning (default .true.).

procedure, public :: add_metadata_float64_array

float64 array specific.

  • interface

    private module subroutine add_metadata_float64_array(this, key, value, description, fmt, warn)

    float64 array specific of parquet_table_metadata%add_metadata; see add_metadata_int32.

    Arguments

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

    table metadata gaining one entry.

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

    metadata key.

    real(kind=real64), intent(in) :: value(:)

    metadata values.

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

    optional free-text description.

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

    optional Fortran edit descriptor for the stored text.

    logical, intent(in), optional :: warn

    .false. suppresses the duplicate-key warning (default .true.).

procedure, public :: add_metadata_logical_array

logical array specific.

  • interface

    private module subroutine add_metadata_logical_array(this, key, value, description, warn)

    logical array specific of parquet_table_metadata%add_metadata; see add_metadata_int32.

    Arguments

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

    table metadata gaining one entry.

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

    metadata key.

    logical, intent(in) :: value(:)

    metadata values.

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

    optional free-text description.

    logical, intent(in), optional :: warn

    .false. suppresses the duplicate-key warning (default .true.).

procedure, public :: add_metadata_string_array

string array specific.

  • interface

    private module subroutine add_metadata_string_array(this, key, value, description, warn)

    string array specific of parquet_table_metadata%add_metadata; see add_metadata_int32.

    Arguments

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

    table metadata gaining one entry.

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

    metadata key.

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

    metadata values.

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

    optional free-text description.

    logical, intent(in), optional :: warn

    .false. suppresses the duplicate-key warning (default .true.).

Appends one flat key-value metadata entry; dispatched by value's type/kind/rank.

  • private interface add_metadata_int32()

    Arguments

    None
  • private interface add_metadata_int64()

    Arguments

    None
  • private interface add_metadata_float32()

    Arguments

    None
  • private interface add_metadata_float64()

    Arguments

    None
  • private interface add_metadata_logical()

    Arguments

    None
  • private interface add_metadata_string()

    Arguments

    None
  • private interface add_metadata_int32_array()

    Arguments

    None
  • private interface add_metadata_int64_array()

    Arguments

    None
  • private interface add_metadata_float32_array()

    Arguments

    None
  • private interface add_metadata_float64_array()

    Arguments

    None
  • private interface add_metadata_logical_array()

    Arguments

    None
  • private interface add_metadata_string_array()

    Arguments

    None

Source Code

    type parquet_table_metadata
        type(parquet_metadata_entry), allocatable :: items(:) !! One entry per add_metadata call (or MAML keyarray: item).
        !> Verbatim source MAML lines, populated by parquet_read_maml; used by
        !> parquet_open_writer(..., write_maml=.true.) to save a sidecar .maml
        !> file next to the .parquet output. add_metadata calls made after
        !> parquet_read_maml append a new keyarray: entry to these lines (see
        !> parquet_append_keyarray_line), so the sidecar reflects them; it is
        !> NOT kept in sync with which columns end up enabled/written, though.
        character(len=:), allocatable :: source_maml_lines(:)
        !> Count of %items present immediately after the most recent parquet_parse_maml
        !> (table:/survey:/... header keys plus any real MAML keyarray: entries) -- the
        !> "base" metadata %clear_metadata preserves, discarding only entries appended by
        !> %add_metadata calls made after that parse. 0 for a never-parsed table_metadata.
        integer :: n_base_items = 0
    contains
        procedure :: clear_metadata => metadata_clear_metadata !! Discards %add_metadata entries added
        !! after the most recent parse, keeping the base (header keys + keyarray:) entries.
        procedure :: add_metadata_int32 !! int32 specific.
        procedure :: add_metadata_int64 !! int64 specific.
        procedure :: add_metadata_float32 !! float32 specific.
        procedure :: add_metadata_float64 !! float64 specific.
        procedure :: add_metadata_logical !! logical specific.
        procedure :: add_metadata_string !! string specific.
        procedure :: add_metadata_int32_array !! int32 array specific.
        procedure :: add_metadata_int64_array !! int64 array specific.
        procedure :: add_metadata_float32_array !! float32 array specific.
        procedure :: add_metadata_float64_array !! float64 array specific.
        procedure :: add_metadata_logical_array !! logical array specific.
        procedure :: add_metadata_string_array !! string array specific.
        !> Appends one flat key-value metadata entry; dispatched by value's type/kind/rank.
        generic :: add_metadata => add_metadata_int32, add_metadata_int64, add_metadata_float32, &
                                    add_metadata_float64, add_metadata_logical, add_metadata_string, &
                                    add_metadata_int32_array, add_metadata_int64_array, add_metadata_float32_array, &
                                    add_metadata_float64_array, add_metadata_logical_array, add_metadata_string_array
    end type parquet_table_metadata