Class SchemaNegotiatorImpl

All Implemented Interfaces:
Direct Known Subclasses:

public class SchemaNegotiatorImpl extends Object implements SchemaNegotiator
Implementation of the schema negotiation between scan operator and batch reader. Anticipates that the select list (and/or the list of predefined fields (implicit, partition) might be set by the scanner. For now, all readers have their own implementation of the select set.

Handles both early- and late-schema readers. Early-schema readers provide a table schema, late-schema readers do not.

If the reader (or, later, the scanner) has a SELECT list, then that select list is pushed down into the result set loader created for the reader.

Also handles parsing out various column types, filling in null columns and (via the vector cache), minimizing changes across readers. In the worst case, a reader might have a column "c" in one file, might skip "c" in the second file, and "c" may appear again in a third file. This negotiator, along with the scan projection and vector cache, "smoothes out" schema changes by preserving the vector for "c" across all three files. In the first and third files "c" is a vector written by the reader, in the second, it is a null column filled in by the scan projector (assuming, of course, that "c" is nullable or an array.)

Pushes limits into the result set loader. The caller must either check the return value from {#code startBatch()}, or call atLimit() after harvest() to detect when the scan has reached the limit. Treat the limit condition the same as EOF.

  • Field Details

    • readerLifecycle

      protected final ReaderLifecycle readerLifecycle
    • readerSchema

      protected TupleMetadata readerSchema
    • isSchemaComplete

      protected boolean isSchemaComplete
    • batchSize

      protected int batchSize
    • baseErrorContext

      protected CustomErrorContext baseErrorContext
    • readerErrorContext

      protected CustomErrorContext readerErrorContext
  • Constructor Details

    • SchemaNegotiatorImpl

      public SchemaNegotiatorImpl(ReaderLifecycle readerLifecycle)
  • Method Details

    • isProjectionEmpty

      public boolean isProjectionEmpty()
      Description copied from interface: SchemaNegotiator
      Report whether the projection list is empty, as occurs in two cases:
      • SELECT COUNT(*) ... -- empty project.
    • SELECT a, b FROM table(c d) -- disjoint project.