parquet_column_exists Interface

interface
public module function parquet_column_exists(reader, name, types) result(exists)

Arguments

Type IntentOptional Attributes Name
type(parquet_reader), intent(in) :: reader

open reader.

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

column name (dotted struct-leaf path allowed).

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

comma-separated type tokens/group aliases.

Return Value logical

.true. if the column exists and (if types given) matches one of its tokens.

Description

Returns .true. if column name (a top-level or dotted struct-leaf path, same convention as every other column-name argument) exists in reader's schema, optionally restricted to a set of allowed data types via types.

types asks "can I read this column as one of these?", not "is its physical type literally one of these?" Each token is compared against the column's target -- the Fortran kind this library reads it into, which is the same narrowest-lossless mapping parquet_get_column_type reports (see its doc-comment below for the full table). So types="int32" matches an int8 or uint16 column, and types="int64" matches a uint32 one, because those are the kinds those columns are read into.

types is a comma-separated list of tokens: any of valid_query_data_types's nine single types ("int32"/"int64"/"float32"/"float64"/"string"/"boolean"/"date"/"time"/"timestamp"), and/or the group aliases "int" (any integer column), "float" (any column readable into a float -- which, since every numeric physical type converts to float64, means every numeric column, integers and decimals included), and "temporal" (date, time, or timestamp). Comparison is case-insensitive. Omit types to check existence regardless of type. error stops if types contains an unrecognized token (checked before the existence check, so a malformed filter is reported even for a column that doesn't exist).

An alias is therefore NOT the union of its member tokens, and that is deliberate. types="float" matches an int32 column (an integer is readable as a float) while types="float64" does not (that column's target kind is int32). The two ask different questions -- "can I read this as a float at all?" against "is float64 the right declaration?" -- and both are useful.

A column this library cannot read at all (a MAP, say) has the target "unknown" and matches no token, but is still found by a plain (no types) existence check.