Class ParquetParserSession

All Implemented Interfaces:
BeanSession, ConverterSession, ArrayRecordReadable, RecordReadable

Session for ParquetParser.
  • Constructor Details

  • Method Details

    • setDebugEnabled

      public static void setDebugEnabled(boolean enabled)
      Enable debug output for schema/column tracing.
      Parameters:
      enabled - true to enable debug logging to temp file.
    • create

      Creates a new session builder.
      Parameters:
      ctx - The parser context.
      Cannot be null.
      Returns:
      A new builder.
    • readRecords

      public RecordReader readRecords(Object input) throws IOException
      Opens a whole-value pull-parser cursor over a Parquet document, bound to this live session. read(...) delegates to the polymorphic ParserSession.read(Object, Class) entry point.
      Specified by:
      readRecords in interface RecordReadable
      Parameters:
      input - The input.
      Returns:
      A new RecordReader cursor.
      Throws:
      IOException - If a problem occurred opening the underlying input.
    • readArrayRecords

      Buffered array-element RecordReader for Parquet, bound to this live session. Calls parse(input, List.class, Object.class) once and iterates the result.
      Why this stays buffered (not O(1) streaming):

      Although a Parquet file is logically row-shaped, it is not a forward, element-at-a-time wire format. Its metadata footer (schema + row-group/column-chunk offsets) lives at the end of the file, so a reader must seek to the tail before it can interpret any row, and values are stored column-major — reconstructing one logical record requires reading one page from every column chunk. Both properties force whole-file (or at minimum whole-row-group) buffering; a true O(1)-in-rows cursor is not achievable over the current single-row-group in-memory decoder. Left buffered by design.

      Specified by:
      readArrayRecords in interface ArrayRecordReadable
      Parameters:
      input - The input.
      Returns:
      A buffered RecordReader.
      Throws:
      IOException - If a problem occurred reading the input.
    • isRecordStreaming

      public boolean isRecordStreaming()
      The Parquet record cursor is buffered/RecordAdapter-backed, not O(1) streaming.
      Specified by:
      isRecordStreaming in interface RecordReadable
      Returns:
      Always false.
    • isArrayRecordStreaming

      public boolean isArrayRecordStreaming()
      The Parquet array-record cursor is buffered/RecordAdapter-backed, not O(1) streaming.

      Parquet's end-of-file metadata footer and column-major value layout require whole-file buffering before any record can be reconstructed, so genuine element-at-a-time streaming is not feasible here; see readArrayRecords(Object) for the full rationale.

      Specified by:
      isArrayRecordStreaming in interface ArrayRecordReadable
      Returns:
      Always false.
    • hasNativeBytes

      public boolean hasNativeBytes()
      Description copied from class: InputStreamParserSession
      Returns whether this binary parser has a native byte-array wire type.

      Mirror of OutputStreamSerializerSession.hasNativeBytes() for the parse side. When true, byte[] payloads are consumed natively from the binary stream (e.g. MsgPack bin family, CBOR byte-string major type 2, BSON binary subtype 0x05) and BinarySwap skips so the raw bytes reach the bean property directly. When false the parser surfaces byte[] payloads as a string (UTF-8 column for Parquet, plain literal for binary RDF) and BinarySwap fires to apply the configured BinaryFormat reverse decoding back to byte[].

      Defaults to true. Subclasses without a native byte-array wire type (e.g. ParquetParserSession and the binary RDF parser sessions) override and return false.

      Overrides:
      hasNativeBytes in class InputStreamParserSession
      Returns:
      true if this parser has a native byte-array wire type.
    • doRead

      protected <T> T doRead(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException
      Description copied from class: ParserSession
      Workhorse method.

      Subclasses are expected to implement this method or Parser.doRead(ParserSession,ParserPipe,ClassMeta).

      The default implementation of this method simply calls Parser.doRead(ParserSession,ParserPipe,ClassMeta).

      Overrides:
      doRead in class ParserSession
      Type Parameters:
      T - The class type of the object to create.
      Parameters:
      pipe - Where to get the input from.
      type - The class type of the object to create. If null or Object.class, object type is based on what's being parsed. For example, when parsing JSON text, it may return a String, Number, JsonMap, etc...
      Returns:
      The parsed object.
      Throws:
      IOException - Thrown by underlying stream.
      ParseException - Malformed input encountered.