parquet_string Derived Type

type, public :: parquet_string

A lightweight, non-owning handle to one element of a parquet_string_column.

Holds a column pointer plus a 1-based index and resolves lazily on access, so it stays valid across appends/reserve/shrink of the referenced column. It is invalidated by erase (index shift), clear, move_from/swap, or the column going out of scope. The referenced column must be declared with the target attribute and must outlive the handle.


Type-Bound Procedures

procedure, public :: length => psv_length

Length of the referenced string.

  • private function psv_length(self) result(n)

    Returns the length of the referenced string (0 for a null element).

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_string), intent(in) :: self

    the handle.

    Return Value integer(kind=int64)

procedure, public :: is_empty => psv_is_empty

Whether the referenced string has zero length.

  • private function psv_is_empty(self, check_null) result(res)

    Returns whether the referenced string has zero length (.true. for a null element).

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_string), intent(in) :: self

    the handle.

    logical, intent(in), optional :: check_null

    .true. => error stop on a null element.

    Return Value logical

procedure, public :: is_null => psv_is_null

Whether the referenced element is null.

  • private function psv_is_null(self) result(res)

    Returns whether the referenced element is null.

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_string), intent(in) :: self

    the handle.

    Return Value logical

procedure, public :: set_null => psv_set_null

Sets the referenced column element to null.

  • private subroutine psv_set_null(self)

    Sets the referenced element to null (write-through: mutates the underlying column, not just this handle -- consistent with every other parquet_string accessor resolving live against the referenced column rather than holding independent state).

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_string), intent(in) :: self

    the handle.

procedure, public :: to_string => psv_to_string

Writes the referenced string into an argument.

  • private subroutine psv_to_string(self, res, null_value, allow_null)

    Writes the referenced string into res. A null element error stops by default; pass null_value to substitute a string, or allow_null=.true. to suppress the abort and return an empty string (detect null via is_null).

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_string), intent(in) :: self

    the handle.

    character(len=:), intent(out), allocatable :: res

    the referenced string.

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

    substitute for a null element.

    logical, intent(in), optional :: allow_null

    .true. => suppress abort, return empty string for null.

procedure, public :: equals => psv_equals

Exact comparison against str.

  • private function psv_equals(self, str, exact, check_null) result(res)

    Exact comparison of the referenced string against str (see the column's equals).

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_string), intent(in) :: self

    the handle.

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

    query string.

    logical, intent(in), optional :: exact

    .false. => trailing-trim both sides.

    logical, intent(in), optional :: check_null

    .true. => error stop on a null element.

    Return Value logical

procedure, public :: contains => psv_contains

Substring search for str.

  • private function psv_contains(self, str, check_null) result(res)

    Substring search within the referenced string (see the column's contains).

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_string), intent(in) :: self

    the handle.

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

    substring to search for.

    logical, intent(in), optional :: check_null

    .true. => error stop on a null element.

    Return Value logical

procedure, public :: startswith => psv_startswith

Prefix test.

  • private function psv_startswith(self, prefix, check_null) result(res)

    Prefix test on the referenced string (see the column's startswith).

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_string), intent(in) :: self

    the handle.

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

    prefix to test.

    logical, intent(in), optional :: check_null

    .true. => error stop on a null element.

    Return Value logical

procedure, public :: endswith => psv_endswith

Suffix test.

  • private function psv_endswith(self, suffix, check_null) result(res)

    Suffix test on the referenced string (see the column's endswith).

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_string), intent(in) :: self

    the handle.

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

    suffix to test.

    logical, intent(in), optional :: check_null

    .true. => error stop on a null element.

    Return Value logical

procedure, public :: print => psv_print

Human-readable representation.

  • private subroutine psv_print(self, unit)

    Writes a human-readable representation of the referenced string to unit (default stdout).

    Arguments

    Type IntentOptional Attributes Name
    class(parquet_string), intent(in) :: self

    the handle.

    integer, intent(in), optional :: unit

    output unit (default output_unit).

Source Code

    type :: parquet_string
        private
        class(parquet_string_column), pointer :: col => null() !! referenced column (borrowed).
        integer(int64) :: idx = 0                              !! 1-based element index.
    contains
        procedure :: length => psv_length          !! Length of the referenced string.
        procedure :: is_empty => psv_is_empty       !! Whether the referenced string has zero length.
        procedure :: is_null => psv_is_null         !! Whether the referenced element is null.
        procedure :: set_null => psv_set_null       !! Sets the referenced column element to null.
        procedure :: to_string => psv_to_string     !! Writes the referenced string into an argument.
        procedure :: equals => psv_equals           !! Exact comparison against str.
        procedure :: contains => psv_contains       !! Substring search for str.
        procedure :: startswith => psv_startswith   !! Prefix test.
        procedure :: endswith => psv_endswith       !! Suffix test.
        procedure :: print => psv_print             !! Human-readable representation.
        !
        ! THIS TYPE DELIBERATELY HAS NO `final` PROCEDURE, and one must not be added for symmetry
        ! with parquet_string_column above -- that one owns buffers and genuinely needs to free
        ! them, whereas this is a NON-OWNING handle: a borrowed pointer and an index. It once
        ! carried `final :: finalize_handle`, whose entire body was `self%col => null()`; that is
        ! unobservable on every path finalization can occur (the object is either ceasing to exist
        ! or being wholly overwritten, and Fortran never auto-deallocates a pointer component, so
        ! there was nothing to release and no dangling reference the caller could still reach).
        !
        ! Three things depend on the absence, so weigh them before reintroducing one:
        !   * nagfor 7.2 emits INVALID C under -C=undefined when finalizing an ARRAY whose element
        !     type has a finalizable COMPONENT -- so `type(t_row) :: rows(3)` holding one of these
        !     would not compile. See fpm.toml's nagdeb comment for the reproducer.
        !   * a finalizable type may not go in an OpenMP `private()` clause under gfortran (CLAUDE.md
        !     has the rule); handles staying non-finalizable is what keeps them usable there, which
        !     is the same reason parquet_table_row and parquet_table_col have no finalizer either.
        !   * intrinsic assignment to or from a finalizable type runs the finalizer twice per
        !     iteration, so `h = col%view(i)` in a user loop would pay for it on every element.
    end type parquet_string