adarshsanjeev commented on code in PR #15689:
URL: https://github.com/apache/druid/pull/15689#discussion_r1461651236
##########
sql/src/main/codegen/includes/insert.ftl:
##########
@@ -21,68 +21,68 @@
* Parses an INSERT statement. This function is copied from SqlInsert in
core/src/main/codegen/templates/Parser.jj,
* with some changes to allow a custom error message if an OVERWRITE clause is
present.
*/
-SqlNode DruidSqlInsert() :
+// Using fully qualified name for Pair class, since Calcite also has a same
class name being used in the Parser.jj
+SqlNode DruidSqlInsertEof() :
{
- final List<SqlLiteral> keywords = new ArrayList<SqlLiteral>();
- final SqlNodeList keywordList;
- final SqlIdentifier tableName;
- SqlNode tableRef;
- SqlNode source;
- final SqlNodeList columnList;
- final Span s;
- final Pair<SqlNodeList, SqlNodeList> p;
+ SqlNode insertNode;
+ final List<SqlLiteral> keywords = new ArrayList<SqlLiteral>();
+ final SqlNodeList keywordList;
+ final SqlIdentifier destination;
+ SqlNode tableRef = null;
+ SqlNode source;
+ final SqlNodeList columnList;
+ final Span s;
+ final Pair<SqlNodeList, SqlNodeList> p;
+ org.apache.druid.java.util.common.Pair<Granularity, String> partitionedBy =
new org.apache.druid.java.util.common.Pair(null, null);
+ SqlNodeList clusteredBy = null;
+ String exportFileFormat = null;
}
{
- (
- <INSERT>
+ (
+ <INSERT>
|
- <UPSERT> { keywords.add(SqlInsertKeyword.UPSERT.symbol(getPos())); }
- )
- { s = span(); }
- SqlInsertKeywords(keywords) {
- keywordList = new SqlNodeList(keywords, s.addAll(keywords).pos());
- }
- <INTO> tableName = CompoundTableIdentifier()
- ( tableRef = TableHints(tableName) | { tableRef = tableName; } )
+ <UPSERT> { keywords.add(SqlInsertKeyword.UPSERT.symbol(getPos())); }
+ )
+ { s = span(); }
+ SqlInsertKeywords(keywords) {
+ keywordList = new SqlNodeList(keywords, s.addAll(keywords).pos());
+ }
+ <INTO>
+ (
+ LOOKAHEAD(2)
+ <EXTERN> <LPAREN> destination = ExternalDestination() <RPAREN>
+ |
+ destination = CompoundTableIdentifier()
+ ( tableRef = TableHints(destination) | { tableRef = destination; } )
[ LOOKAHEAD(5) tableRef = ExtendTable(tableRef) ]
- (
- LOOKAHEAD(2)
- p = ParenthesizedCompoundIdentifierList() {
- if (p.right.size() > 0) {
- tableRef = extend(tableRef, p.right);
- }
- if (p.left.size() > 0) {
- columnList = p.left;
- } else {
- columnList = null;
- }
- }
- | { columnList = null; }
- )
- (
+ )
+ (
+ LOOKAHEAD(2)
Review Comment:
This part of the code has not been changed, only moved. It is also present
in the default SqlInsert statement in calcite.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]