Interface Planner

  • All Superinterfaces:
    java.lang.AutoCloseable
    All Known Implementing Classes:
    PlannerImpl

    public interface Planner
    extends java.lang.AutoCloseable
    A façade that covers Calcite's query planning process: parse SQL, validate the parse tree, convert the parse tree to a relational expression, and optimize the relational expression.

    Planner is NOT thread safe. However, it can be reused for different queries. The consumer of this interface is responsible for calling reset() after each use of Planner that corresponds to a different query.

    • Method Detail

      • parse

        default SqlNode parse​(java.lang.String sql)
                       throws SqlParseException
        Parses and validates a SQL statement.
        Parameters:
        sql - The SQL statement to parse.
        Returns:
        The root node of the SQL parse tree.
        Throws:
        SqlParseException - on parse error
      • parse

        SqlNode parse​(java.io.Reader source)
               throws SqlParseException
        Parses and validates a SQL statement.
        Parameters:
        source - A reader which will provide the SQL statement to parse.
        Returns:
        The root node of the SQL parse tree.
        Throws:
        SqlParseException - on parse error
      • transform

        RelNode transform​(int ruleSetIndex,
                          RelTraitSet requiredOutputTraits,
                          RelNode rel)
                   throws RelConversionException
        Converts one relational expression tree into another relational expression based on a particular rule set and requires set of traits.
        Parameters:
        ruleSetIndex - The RuleSet to use for conversion purposes. Note that this is zero-indexed and is based on the list and order of RuleSets provided in the construction of this Planner.
        requiredOutputTraits - The set of RelTraits required of the root node at the termination of the planning cycle.
        rel - The root of the RelNode tree to convert.
        Returns:
        The root of the new RelNode tree.
        Throws:
        RelConversionException - on conversion error
      • reset

        void reset()
        Resets this Planner to be used with a new query. This should be called between each new query.
      • close

        void close()
        Releases all internal resources utilized while this Planner exists. Once called, this Planner object is no longer valid.
        Specified by:
        close in interface java.lang.AutoCloseable