Class AceroSubstraitConsumer

java.lang.Object
org.apache.arrow.dataset.substrait.AceroSubstraitConsumer

public final class AceroSubstraitConsumer extends Object
Class to expose Java Substrait API for end users, currently operations supported are only to Consume Substrait Plan in Plan format (JSON) or Binary format (ByteBuffer).
  • Constructor Details

    • AceroSubstraitConsumer

      public AceroSubstraitConsumer(BufferAllocator allocator)
  • Method Details

    • runQuery

      public ArrowReader runQuery(String plan) throws Exception
      Run Substrait plan.
      Parameters:
      plan - The JSON Substrait plan.
      Returns:
      the ArrowReader to iterate for record batches.
      Throws:
      Exception
    • runQuery

      public ArrowReader runQuery(String plan, Map<String,ArrowReader> namedTables) throws Exception
      Run Substrait plan.
      Parameters:
      plan - The JSON Substrait plan.
      namedTables - A mapping of named tables referenced by the plan to an ArrowReader providing the data for the table. Contains the Table Name to Query as a Key and ArrowReader as a Value.
      ArrowReader nationReader = scanner.scanBatches();
       Map<String, ArrowReader> namedTables = new HashMap<>();
       namedTables.put("NATION", nationReader);
      Returns:
      the ArrowReader to iterate for record batches.
      Throws:
      Exception
    • runQuery

      public ArrowReader runQuery(ByteBuffer plan) throws Exception
      Run Substrait plan.
      Parameters:
      plan - the binary Substrait plan.
      Returns:
      the ArrowReader to iterate for record batches.
      Throws:
      Exception
    • runQuery

      public ArrowReader runQuery(ByteBuffer plan, Map<String,ArrowReader> namedTables) throws Exception
      Read binary Substrait plan, execute and return an ArrowReader to read Schema and ArrowRecordBatches.
      Parameters:
      plan - the binary Substrait plan.
      namedTables - A mapping of named tables referenced by the plan to an ArrowReader providing the data for the table. Contains the Table Name to Query as a Key and ArrowReader as a Value.
      ArrowReader nationReader = scanner.scanBatches();
       Map<String, ArrowReader> namedTables = new HashMap<>();
       namedTables.put("NATION", nationReader);
      Returns:
      the ArrowReader to iterate for record batches.
      Throws:
      Exception