Interface FieldAccessor
- All Known Subinterfaces:
PqStruct, PqVariantObject, RowReader, StructAccessor
Common interface for name-based access to fields whose values are primitives,
Variants, or absent. Shared by both Parquet-struct accessors (StructAccessor)
and Variant-object accessors (PqVariantObject), and by top-level
RowReader.
Complex Parquet-only accessors (getStruct / getList / getMap) live on
StructAccessor. Variant-specific accessors (getObject / getArray) live
on PqVariantObject.
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]Get a BINARY field value by name.booleangetBoolean(String name) Get a BOOLEAN field value by name.Get a DATE field value by name.getDecimal(String name) Get a DECIMAL field value by name.doubleGet a DOUBLE field value by name.intGet the number of fields in this record.getFieldName(int index) Get the name of a field by index.floatGet a FLOAT field value by name.intGet an INT32 field value by name.getInterval(String name) Get an INTERVAL field value by name.getLocalTimestamp(String name) Get a local-wall-clock TIMESTAMP field value by name.longGet an INT64 field value by name.getRawValue(String name) Get a field value by name as its raw physical representation, without logical-type decoding.Get a STRING field value by name.Get a TIME field value by name.getTimestamp(String name) Get a UTC-adjusted TIMESTAMP field value by name.Get a UUID field value by name.Get a field value by name, decoded to its logical-type representation.getVariant(String name) Get a VARIANT field value by name.booleanCheck if a field is null by name.
-
Method Details
-
getInt
Get an INT32 field value by name.- Parameters:
name- the field name- Returns:
- the int value
- Throws:
NullPointerException- if the field is null
-
getLong
Get an INT64 field value by name.- Parameters:
name- the field name- Returns:
- the long value
- Throws:
NullPointerException- if the field is null
-
getFloat
Get a FLOAT field value by name. Also accepts FLOAT16 columns (FIXED_LEN_BYTE_ARRAY(2)annotatedFloat16Type); the 2-byte payload is losslessly widened to single-precisionfloat.- Parameters:
name- the field name- Returns:
- the float value
- Throws:
NullPointerException- if the field is null
-
getDouble
Get a DOUBLE field value by name.- Parameters:
name- the field name- Returns:
- the double value
- Throws:
NullPointerException- if the field is null
-
getBoolean
Get a BOOLEAN field value by name.- Parameters:
name- the field name- Returns:
- the boolean value
- Throws:
NullPointerException- if the field is null
-
getString
-
getBinary
Get a BINARY field value by name.- Parameters:
name- the field name- Returns:
- the byte array, or null if the field is null
-
getDate
-
getTime
-
getTimestamp
Get a UTC-adjusted TIMESTAMP field value by name. The column'sTimestampTypemust haveisAdjustedToUTC = true(the value is an instant normalized to UTC). For wall-clock TIMESTAMP columns (isAdjustedToUTC = false) usegetLocalTimestamp(String)instead.- Parameters:
name- the field name- Returns:
- the instant value, or null if the field is null
- Throws:
IllegalStateException- if the column is a local-wall-clock TIMESTAMP
-
getLocalTimestamp
Get a local-wall-clock TIMESTAMP field value by name. The column'sTimestampTypemust haveisAdjustedToUTC = false(the value is a wall-clock timestamp with no timezone). For UTC-adjusted columns usegetTimestamp(String)instead.- Parameters:
name- the field name- Returns:
- the local timestamp value, or null if the field is null
- Throws:
IllegalStateException- if the column is a UTC-adjusted TIMESTAMP
-
getDecimal
Get a DECIMAL field value by name.- Parameters:
name- the field name- Returns:
- the decimal value, or null if the field is null
-
getUuid
-
getInterval
Get an INTERVAL field value by name.
The Parquet
INTERVALlogical type stores three independent components (months, days, milliseconds) as little-endian unsigned 32-bit integers in a 12-byte FIXED_LEN_BYTE_ARRAY. The components are not normalized into a single duration. SeePqIntervalfor component semantics.- Parameters:
name- the field name- Returns:
- the interval value, or null if the field is null
-
getVariant
Get a VARIANT field value by name. Works both for a Parquet group annotated with theVARIANTlogical type (where the returned value is assembled from the underlyingmetadata+valuebinary columns) and for a Variant object's field whose value is itself a Variant — every Variant sub-value can be surfaced through this method.- Parameters:
name- the field name- Returns:
- the Variant accessor, or null if the field is null
-
getValue
Get a field value by name, decoded to its logical-type representation.
Returns the value in the same form as the typed accessors above:
Integer/Long/Float/Double/Booleanfor primitives,Stringfor STRING,LocalDatefor DATE,LocalTimefor TIME,Instantfor UTC-adjusted TIMESTAMP,LocalDateTimefor local-wall-clock TIMESTAMP,BigDecimalfor DECIMAL,UUIDfor UUID,PqIntervalfor INTERVAL,PqVariantfor VARIANT, andbyte[]for BYTE_ARRAY / FIXED_LEN_BYTE_ARRAY with no logical-type annotation. Nested groups surface asPqStruct/PqList/PqMap.Use
getRawValue(String)to obtain the underlying physical value instead.- Parameters:
name- the field name- Returns:
- the decoded value, or null if the field is null
-
getRawValue
Get a field value by name as its raw physical representation, without logical-type decoding. Primitive leaves surface as the underlyingInteger/Long/Float/Double/Boolean/byte[]; e.g. a TIMESTAMP returns the underlyingLongrather than anInstant, and a DECIMAL returns the underlyingbyte[]/Integer/Long. Nested groups (struct / list / map / variant) are still returned as their typed flyweights since they have no useful "raw" form.- Parameters:
name- the field name- Returns:
- the raw value, or null if the field is null
-
isNull
Check if a field is null by name.- Parameters:
name- the field name- Returns:
- true if the field is null
-
getFieldCount
int getFieldCount()Get the number of fields in this record.- Returns:
- the field count
-
getFieldName
Get the name of a field by index.- Parameters:
index- the field index (0-based)- Returns:
- the field name
-