Interface ScanOperatorEvents

All Known Implementing Classes:
ColumnsScanFramework, FileScanFramework, ManagedScanFramework, ScanEventListener

public interface ScanOperatorEvents
Interface to the set of readers, and reader schema, that the scan operator manages. The reader factory creates and returns the readers to use for the scan, as determined by the specific physical plan. The reader factory also translates from the select list provided in the physical plan to the actual columns returned from the scan operator. The translation is reader-specific; this interface allows the scan operator to trigger various lifecycle events.

This interface decouples the scan implementation from the generic tasks needed to implement Drill's Volcano iterator protocol for operators, and Drill's schema and batch semantics. A scan implementation need only implement this interface to add plugin-specific scan behavior.

While this interface allows a wide variety of implementations, the intent is that most actual scanners will use the "managed" framework that handles the routine projection, vector management and other tasks that tend to be common across scanners. See ScanSchemaOrchestrator for the managed framework.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Build the scan-level schema from the physical operator select list.
    void
    Called when the scan operator itself is closed.
    A scanner typically readers multiple data sources (such as files or file blocks.) A batch reader handles each read.
  • Method Details

    • bind

      void bind(OperatorContext context)
      Build the scan-level schema from the physical operator select list. The operator context is provided to allow access to the user name, to options, and to other information that might influence schema resolution.

      After this call, the schema manager should be ready to build a reader-specific schema for each reader as it is opened.

      Parameters:
      context - the operator context for the scan operator
    • nextReader

      RowBatchReader nextReader()
      A scanner typically readers multiple data sources (such as files or file blocks.) A batch reader handles each read. This method returns the next reader in whatever sequence that this scan defines.

      The preferred implementation is to create each batch reader in this call to minimize resource usage. Production queries may read thousands of files or blocks, so incremental reader creation can be far more efficient than creating readers at the start of the scan.

      Returns:
      a batch reader for one of the scan elements within the scan physical plan for this scan operator
    • close

      void close()
      Called when the scan operator itself is closed. Indicates that no more readers are available.