Class DruidSqlInsert

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.DruidSqlInsert
All Implemented Interfaces:
Cloneable

public class DruidSqlInsert extends DruidSqlIngest
Extends the 'insert' call to hold custom parameters specific to Druid i.e. PARTITIONED BY and CLUSTERED BY This class extends the DruidSqlIngest 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
     
    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
    DruidSqlInsert(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)
    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.SqlOperator
     
    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, getOperandList, 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_INSERT_SEGMENT_GRANULARITY

      public static final String SQL_INSERT_SEGMENT_GRANULARITY
      See Also:
    • SQL_INSERT_QUERY_GRANULARITY

      public static final String SQL_INSERT_QUERY_GRANULARITY
      See Also:
    • OPERATOR

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

    • DruidSqlInsert

      public DruidSqlInsert(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)
      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 DruidSqlInsert 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)
    • getOperator

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

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