Interface PqStruct
public interface PqStruct
Type-safe struct interface for reading nested Parquet data.
Provides dedicated accessor methods for each type, similar to JDBC ResultSet.
This interface is used for nested struct access, not for top-level row iteration.
For top-level row access, use RowReader directly.
while (rowReader.hasNext()) {
rowReader.next();
int id = rowReader.getInt("id");
// Nested struct
PqStruct address = rowReader.getStruct("address");
String city = address.getString("city");
// List of structs
PqList items = rowReader.getList("items");
for (PqStruct item : items.structs()) { ... }
}
-
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 struct.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.Get a LIST field value by name.getListOfDoubles(String name) Get a DOUBLE list field by name.getListOfInts(String name) Get an INT32 list field by name.getListOfLongs(String name) Get an INT64 list field by name.longGet an INT64 field value by name.Get a MAP field value by name.Get a STRING field value by name.Get a nested struct field value by name.Get a TIME field value by name.getTimestamp(String name) Get a TIMESTAMP field value by name.Get a UUID field value by name.Get a field value by name without type conversion.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 nullIllegalArgumentException- if the field type is not INT32
-
getLong
Get an INT64 field value by name.- Parameters:
name- the field name- Returns:
- the long value
- Throws:
NullPointerException- if the field is nullIllegalArgumentException- if the field type is not INT64
-
getFloat
Get a FLOAT field value by name.- Parameters:
name- the field name- Returns:
- the float value
- Throws:
NullPointerException- if the field is nullIllegalArgumentException- if the field type is not FLOAT
-
getDouble
Get a DOUBLE field value by name.- Parameters:
name- the field name- Returns:
- the double value
- Throws:
NullPointerException- if the field is nullIllegalArgumentException- if the field type is not DOUBLE
-
getBoolean
Get a BOOLEAN field value by name.- Parameters:
name- the field name- Returns:
- the boolean value
- Throws:
NullPointerException- if the field is nullIllegalArgumentException- if the field type is not BOOLEAN
-
getString
Get a STRING field value by name.- Parameters:
name- the field name- Returns:
- the string value, or null if the field is null
- Throws:
IllegalArgumentException- if the field type is not STRING
-
getBinary
Get a BINARY field value by name.- Parameters:
name- the field name- Returns:
- the byte array, or null if the field is null
- Throws:
IllegalArgumentException- if the field type is not BINARY
-
getDate
Get a DATE field value by name.- Parameters:
name- the field name- Returns:
- the date value, or null if the field is null
- Throws:
IllegalArgumentException- if the field type is not DATE
-
getTime
Get a TIME field value by name.- Parameters:
name- the field name- Returns:
- the time value, or null if the field is null
- Throws:
IllegalArgumentException- if the field type is not TIME
-
getTimestamp
Get a TIMESTAMP field value by name.- Parameters:
name- the field name- Returns:
- the instant value, or null if the field is null
- Throws:
IllegalArgumentException- if the field type is not 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
- Throws:
IllegalArgumentException- if the field type is not DECIMAL
-
getUuid
Get a UUID field value by name.- Parameters:
name- the field name- Returns:
- the UUID value, or null if the field is null
- Throws:
IllegalArgumentException- if the field type is not UUID
-
getStruct
Get a nested struct field value by name.- Parameters:
name- the field name- Returns:
- the nested struct, or null if the field is null
- Throws:
IllegalArgumentException- if the field type is not a struct
-
getListOfInts
Get an INT32 list field by name.- Parameters:
name- the field name- Returns:
- the int list, or null if the field is null
- Throws:
IllegalArgumentException- if the field is not a list of INT32
-
getListOfLongs
Get an INT64 list field by name.- Parameters:
name- the field name- Returns:
- the long list, or null if the field is null
- Throws:
IllegalArgumentException- if the field is not a list of INT64
-
getListOfDoubles
Get a DOUBLE list field by name.- Parameters:
name- the field name- Returns:
- the double list, or null if the field is null
- Throws:
IllegalArgumentException- if the field is not a list of DOUBLE
-
getList
Get a LIST field value by name.PqList tags = struct.getList("tags"); for (String tag : tags.strings()) { System.out.println(tag); }- Parameters:
name- the field name- Returns:
- the list, or null if the field is null
- Throws:
IllegalArgumentException- if the field type is not a list
-
getMap
Get a MAP field value by name.- Parameters:
name- the field name- Returns:
- the map, or null if the field is null
- Throws:
IllegalArgumentException- if the field type is not a map
-
getValue
-
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 struct.- Returns:
- the field count
-
getFieldName
Get the name of a field by index.- Parameters:
index- the field index (0-based)- Returns:
- the field name
-