Class DruidSqlReplace

java.lang.Object
org.apache.calcite.sql.SqlNode
org.apache.calcite.sql.SqlCall
org.apache.calcite.sql.SqlInsert
org.apache.druid.sql.calcite.parser.DruidSqlIngest
org.apache.druid.sql.calcite.parser.DruidSqlReplace
All Implemented Interfaces:
Cloneable

public class DruidSqlReplace extends DruidSqlIngest
Extends the 'replace' call to hold custom parameters specific to Druid i.e. PARTITIONED BY and the PARTITION SPECS This class extends the SqlInsert so that this SqlNode can be used in SqlToRelConverter for getting converted into RelNode, and further processing
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.apache.calcite.sql.SqlOperator
     
    static final String
     

    Fields inherited from class org.apache.druid.sql.calcite.parser.DruidSqlIngest

    clusteredBy, partitionedBy, SQL_EXPORT_FILE_FORMAT

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

    EMPTY_ARRAY, pos
  • Constructor Summary

    Constructors
    Constructor
    Description
    DruidSqlReplace(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlNodeList keywords, org.apache.calcite.sql.SqlNode targetTable, org.apache.calcite.sql.SqlNode source, org.apache.calcite.sql.SqlNodeList columnList, SqlGranularityLiteral partitionedBy, org.apache.calcite.sql.SqlNodeList clusteredBy, org.apache.calcite.sql.SqlIdentifier exportFileFormat, org.apache.calcite.sql.SqlNode replaceTimeQuery)
    While partitionedBy can be null as arguments to the constructor, this is disallowed (semantically) and IngestHandler.validate() performs checks to ensure that.
  • Method Summary

    Modifier and Type
    Method
    Description
    create(org.apache.calcite.sql.SqlInsert insertNode, SqlGranularityLiteral partitionedBy, org.apache.calcite.sql.SqlNodeList clusteredBy, org.apache.calcite.sql.SqlIdentifier exportFileFormat, org.apache.calcite.sql.SqlNode replaceTimeQuery)
     
    List<org.apache.calcite.sql.SqlNode>
     
    org.apache.calcite.sql.SqlOperator
     
    org.apache.calcite.sql.SqlNode
     
    void
    unparse(org.apache.calcite.sql.SqlWriter writer, int leftPrec, int rightPrec)
     

    Methods inherited from class org.apache.druid.sql.calcite.parser.DruidSqlIngest

    getClusteredBy, getExportFileFormat, getPartitionedBy

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

    getKind, getModifierNode, getSource, getTargetColumnList, getTargetTable, isUpsert, setOperand, setSource, validate

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

    accept, clone, equalsDeep, findValidOptions, getCallSignature, getFunctionQuantifier, getMonotonicity, isCountStar, isExpanded, operand, operandCount

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

    clone, clone, cloneArray, equalDeep, equalDeep, equalsDeep, getParserPosition, isA, toList, toList, toSqlString, toSqlString, toSqlString, toString, unparseWithParentheses, validateExpr

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • SQL_REPLACE_TIME_CHUNKS

      public static final String SQL_REPLACE_TIME_CHUNKS
      See Also:
    • OPERATOR

      public static final org.apache.calcite.sql.SqlOperator OPERATOR
  • Constructor Details

    • DruidSqlReplace

      public DruidSqlReplace(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlNodeList keywords, org.apache.calcite.sql.SqlNode targetTable, org.apache.calcite.sql.SqlNode source, org.apache.calcite.sql.SqlNodeList columnList, @Nullable SqlGranularityLiteral partitionedBy, @Nullable org.apache.calcite.sql.SqlNodeList clusteredBy, @Nullable org.apache.calcite.sql.SqlIdentifier exportFileFormat, @Nullable org.apache.calcite.sql.SqlNode replaceTimeQuery)
      While partitionedBy can be null as arguments to the constructor, this is disallowed (semantically) and IngestHandler.validate() performs checks to ensure that. This helps in producing friendly errors when the PARTITIONED BY custom clause is not present, and keeps its error separate from JavaCC/Calcite's custom errors which can be cryptic when someone accidentally forgets to explicitly specify the PARTITIONED BY clause
  • Method Details

    • create

      public static DruidSqlReplace create(@Nonnull org.apache.calcite.sql.SqlInsert insertNode, @Nullable SqlGranularityLiteral partitionedBy, @Nullable org.apache.calcite.sql.SqlNodeList clusteredBy, @Nullable org.apache.calcite.sql.SqlIdentifier exportFileFormat, @Nullable org.apache.calcite.sql.SqlNode replaceTimeQuery)
    • getReplaceTimeQuery

      public org.apache.calcite.sql.SqlNode getReplaceTimeQuery()
    • getOperator

      @Nonnull public org.apache.calcite.sql.SqlOperator getOperator()
      Overrides:
      getOperator in class org.apache.calcite.sql.SqlInsert
    • getOperandList

      public List<org.apache.calcite.sql.SqlNode> getOperandList()
      Overrides:
      getOperandList in class DruidSqlIngest
    • unparse

      public void unparse(org.apache.calcite.sql.SqlWriter writer, int leftPrec, int rightPrec)
      Overrides:
      unparse in class org.apache.calcite.sql.SqlInsert