Package org.apache.flink.sql.parser.dml
Class RichSqlInsert
- java.lang.Object
-
- org.apache.calcite.sql.SqlNode
-
- org.apache.calcite.sql.SqlCall
-
- org.apache.calcite.sql.SqlInsert
-
- org.apache.flink.sql.parser.dml.RichSqlInsert
-
- All Implemented Interfaces:
Cloneable
public class RichSqlInsert extends org.apache.calcite.sql.SqlInsertASqlInsertthat have some extension functions like partition, overwrite. *
-
-
Constructor Summary
Constructors Constructor Description RichSqlInsert(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlNodeList keywords, org.apache.calcite.sql.SqlNodeList extendedKeywords, org.apache.calcite.sql.SqlNode targetTable, org.apache.calcite.sql.SqlNode source, org.apache.calcite.sql.SqlNodeList columnList, org.apache.calcite.sql.SqlNodeList staticPartitions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LinkedHashMap<String,String>getStaticPartitionKVs()Get static partition key value pair as strings.org.apache.calcite.sql.SqlNodeListgetStaticPartitions()org.apache.calcite.sql.SqlNodeListgetTableHints()Returns the table hints as list ofSqlNodefor current insert node.org.apache.calcite.sql.SqlNodegetTargetTableID()Returns the target table identifier.booleanisOverwrite()Returns whether the insert mode is overwrite (for whole table or for specific partitions).static booleanisUpsert(List<org.apache.calcite.sql.SqlLiteral> keywords)voidunparse(org.apache.calcite.sql.SqlWriter writer, int leftPrec, int rightPrec)-
Methods inherited from class org.apache.calcite.sql.SqlInsert
getKind, getModifierNode, getOperandList, getOperator, 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
-
-
-
-
Constructor Detail
-
RichSqlInsert
public RichSqlInsert(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlNodeList keywords, org.apache.calcite.sql.SqlNodeList extendedKeywords, org.apache.calcite.sql.SqlNode targetTable, org.apache.calcite.sql.SqlNode source, org.apache.calcite.sql.SqlNodeList columnList, org.apache.calcite.sql.SqlNodeList staticPartitions)
-
-
Method Detail
-
getStaticPartitions
public org.apache.calcite.sql.SqlNodeList getStaticPartitions()
- Returns:
- the list of partition key-value pairs, returns empty if there is no partition specifications.
-
getStaticPartitionKVs
public LinkedHashMap<String,String> getStaticPartitionKVs()
Get static partition key value pair as strings.For character literals we return the unquoted and unescaped values. For other types we use
SqlNode.toString()to get the string format of the value literal. If the string format is not what you need, usegetStaticPartitions().- Returns:
- the mapping of column names to values of partition specifications, returns an empty map if there is no partition specifications.
-
getTargetTableID
public org.apache.calcite.sql.SqlNode getTargetTableID()
Returns the target table identifier.
-
getTableHints
public org.apache.calcite.sql.SqlNodeList getTableHints()
Returns the table hints as list ofSqlNodefor current insert node.
-
unparse
public void unparse(org.apache.calcite.sql.SqlWriter writer, int leftPrec, int rightPrec)- Overrides:
unparsein classorg.apache.calcite.sql.SqlInsert
-
isUpsert
public static boolean isUpsert(List<org.apache.calcite.sql.SqlLiteral> keywords)
-
isOverwrite
public boolean isOverwrite()
Returns whether the insert mode is overwrite (for whole table or for specific partitions).- Returns:
- true if this is overwrite mode
-
-