Fix error messages relating to OVERWRITE keyword (#14870)

OVERWRITE should not be a fully reserved keyword
This commit is contained in:
Zoltan Haindrich 2023-08-22 12:47:49 +02:00 committed by GitHub
parent bd505062de
commit 14c1aff150
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 4 deletions

View File

@ -329,7 +329,8 @@ public class MSQReplaceTest extends MSQTestBase
.setExpectedDataSource("foo1") .setExpectedDataSource("foo1")
.setQueryContext(context) .setQueryContext(context)
.setExpectedValidationErrorMatcher(invalidSqlContains( .setExpectedValidationErrorMatcher(invalidSqlContains(
"Incorrect syntax near the keyword 'OVERWRITE'" "Missing time chunk information in OVERWRITE clause for REPLACE. "
+ "Use OVERWRITE WHERE <__time based condition> or OVERWRITE ALL to overwrite the entire table."
)) ))
.verifyPlanningErrors(); .verifyPlanningErrors();
} }

View File

@ -67,6 +67,10 @@ data: {
"PARTITIONED" "PARTITIONED"
] ]
nonReservedKeywordsToAdd: [
"OVERWRITE"
]
# List of methods for parsing custom SQL statements. # List of methods for parsing custom SQL statements.
# Return type of method implementation should be 'SqlNode'. # Return type of method implementation should be 'SqlNode'.
# Example: SqlShowDatabases(), SqlShowTables(). # Example: SqlShowDatabases(), SqlShowTables().

View File

@ -43,7 +43,10 @@ SqlNode DruidSqlReplaceEof() :
} }
] ]
[ [
<OVERWRITE> replaceTimeQuery = ReplaceTimeQuery() <OVERWRITE>
[
replaceTimeQuery = ReplaceTimeQuery()
]
] ]
source = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY) source = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY)
// PARTITIONED BY is necessary, but is kept optional in the grammar. It is asserted that it is not missing in the // PARTITIONED BY is necessary, but is kept optional in the grammar. It is asserted that it is not missing in the

View File

@ -440,8 +440,9 @@ public class CalciteReplaceDmlTest extends CalciteIngestionDmlTest
{ {
testIngestionQuery() testIngestionQuery()
.sql("REPLACE INTO dst OVERWRITE SELECT * FROM foo PARTITIONED BY ALL TIME") .sql("REPLACE INTO dst OVERWRITE SELECT * FROM foo PARTITIONED BY ALL TIME")
.expectValidationError(invalidSqlContains( .expectValidationError(invalidSqlIs(
"Incorrect syntax near the keyword 'OVERWRITE' at line 1, column 18." "Missing time chunk information in OVERWRITE clause for REPLACE. "
+ "Use OVERWRITE WHERE <__time based condition> or OVERWRITE ALL to overwrite the entire table."
)) ))
.verify(); .verify();
} }