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 Details

    • getInt

      int getInt(String name)
      Get an INT32 field value by name.
      Parameters:
      name - the field name
      Returns:
      the int value
      Throws:
      NullPointerException - if the field is null
      IllegalArgumentException - if the field type is not INT32
    • getLong

      long getLong(String name)
      Get an INT64 field value by name.
      Parameters:
      name - the field name
      Returns:
      the long value
      Throws:
      NullPointerException - if the field is null
      IllegalArgumentException - if the field type is not INT64
    • getFloat

      float getFloat(String name)
      Get a FLOAT field value by name.
      Parameters:
      name - the field name
      Returns:
      the float value
      Throws:
      NullPointerException - if the field is null
      IllegalArgumentException - if the field type is not FLOAT
    • getDouble

      double getDouble(String name)
      Get a DOUBLE field value by name.
      Parameters:
      name - the field name
      Returns:
      the double value
      Throws:
      NullPointerException - if the field is null
      IllegalArgumentException - if the field type is not DOUBLE
    • getBoolean

      boolean getBoolean(String name)
      Get a BOOLEAN field value by name.
      Parameters:
      name - the field name
      Returns:
      the boolean value
      Throws:
      NullPointerException - if the field is null
      IllegalArgumentException - if the field type is not BOOLEAN
    • getString

      String getString(String name)
      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

      byte[] getBinary(String name)
      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

      LocalDate getDate(String name)
      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

      LocalTime getTime(String name)
      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

      Instant getTimestamp(String name)
      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

      BigDecimal getDecimal(String name)
      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

      UUID getUuid(String name)
      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

      PqStruct getStruct(String name)
      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

      PqIntList getListOfInts(String name)
      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

      PqLongList getListOfLongs(String name)
      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

      PqDoubleList getListOfDoubles(String name)
      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

      PqList getList(String name)
      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

      PqMap getMap(String name)
      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

      Object getValue(String name)
      Get a field value by name without type conversion. Returns the raw value as stored internally.
      Parameters:
      name - the field name
      Returns:
      the raw value, or null if the field is null
    • isNull

      boolean isNull(String name)
      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

      String getFieldName(int index)
      Get the name of a field by index.
      Parameters:
      index - the field index (0-based)
      Returns:
      the field name