Class DruidLogicalValuesRule

java.lang.Object
org.apache.calcite.plan.RelOptRule
org.apache.druid.sql.calcite.rule.DruidLogicalValuesRule

public class DruidLogicalValuesRule extends org.apache.calcite.plan.RelOptRule
A RelOptRule that converts LogicalValues into InlineDataSource. This rule is used when the query directly reads in-memory tuples. For example, given a query of `SELECT 1 + 1`, the query planner will create LogicalValues that contains one tuple, which in turn containing one column of value 2.

The query planner can sometimes reduce a regular query to a query that reads in-memory tuples. For example, `SELECT count(*) FROM foo WHERE 1 = 0` is reduced to `SELECT 0`. This rule will be used for this case as well.

  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.calcite.plan.RelOptRule

    org.apache.calcite.plan.RelOptRule.ConverterRelOptRuleOperand
  • Field Summary

    Fields inherited from class org.apache.calcite.plan.RelOptRule

    description, operands, relBuilderFactory
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Object
    getValueFromLiteral(org.apache.calcite.rex.RexLiteral literal, PlannerContext plannerContext)
    Retrieves value from the literal based on Druid data type mapping (https://druid.apache.org/docs/latest/querying/sql.html#standard-types).
    void
    onMatch(org.apache.calcite.plan.RelOptRuleCall call)
     

    Methods inherited from class org.apache.calcite.plan.RelOptRule

    any, convert, convert, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, none, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DruidLogicalValuesRule

      public DruidLogicalValuesRule(PlannerContext plannerContext)
  • Method Details

    • onMatch

      public void onMatch(org.apache.calcite.plan.RelOptRuleCall call)
      Specified by:
      onMatch in class org.apache.calcite.plan.RelOptRule
    • getValueFromLiteral

      @Nullable public static Object getValueFromLiteral(org.apache.calcite.rex.RexLiteral literal, PlannerContext plannerContext)
      Retrieves value from the literal based on Druid data type mapping (https://druid.apache.org/docs/latest/querying/sql.html#standard-types).
      Throws:
      IllegalArgumentException - for unsupported types