Class ExtendOperator

java.lang.Object
org.apache.calcite.sql.SqlOperator
org.apache.calcite.sql.SqlSpecialOperator
org.apache.calcite.sql.SqlInternalOperator
org.apache.druid.sql.calcite.external.ExtendOperator

public class ExtendOperator extends org.apache.calcite.sql.SqlInternalOperator
Druid-specific implementation of the EXTEND operator in Calcite, which is said to have been added for Apache Phoenix, and which we repurpose to supply a schema for an ingest input table.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.calcite.sql.SqlSpecialOperator

    org.apache.calcite.sql.SqlSpecialOperator.ReduceResult, org.apache.calcite.sql.SqlSpecialOperator.TokenSequence
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ExtendOperator
     

    Fields inherited from class org.apache.calcite.sql.SqlOperator

    kind, MDX_PRECEDENCE, NL
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.calcite.sql.SqlNode
    rewriteCall(org.apache.calcite.sql.validate.SqlValidator validator, org.apache.calcite.sql.SqlCall call)
    Rewrite the EXTEND node (which, in Druid, has a structure different than what Calcite expects), into a table macro, with the schema squirreled away in an ad-hoc instance of the macro.

    Methods inherited from class org.apache.calcite.sql.SqlInternalOperator

    deriveType, getSyntax

    Methods inherited from class org.apache.calcite.sql.SqlSpecialOperator

    reduceExpr

    Methods inherited from class org.apache.calcite.sql.SqlOperator

    acceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, deriveOperandType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getNameAsId, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, getStrongPolicyInference, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, not, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, reverse, rightPrec, toString, unparse, unparseListClause, unparseListClause, validateCall, validateOperands, validRexOperands

    Methods inherited from class java.lang.Object

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

  • Method Details

    • rewriteCall

      public org.apache.calcite.sql.SqlNode rewriteCall(org.apache.calcite.sql.validate.SqlValidator validator, org.apache.calcite.sql.SqlCall call)
      Rewrite the EXTEND node (which, in Druid, has a structure different than what Calcite expects), into a table macro, with the schema squirreled away in an ad-hoc instance of the macro. We must do it this way because we can't change Calcite to define a new node type that holds onto the schema.

      The node structure is:

      
       EXTEND(
         TABLE(
           <table fn>(
             <table macro>
           )
         ),
         <schema>
       )

      Note that the table macro is not an operand: it is an implicit member of the table macro function operator.

      Overrides:
      rewriteCall in class org.apache.calcite.sql.SqlOperator