This is an automated email from the ASF dual-hosted git repository.
kadir pushed a commit to branch PHOENIX-7001-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/PHOENIX-7001-feature by this
push:
new 87a2ea1011 PHOENIX-7008: Fix for parser gap and fix for failing test
(#1812)
87a2ea1011 is described below
commit 87a2ea1011557cd464f8f3a69138615831996149
Author: Hari Krishna Dara
AuthorDate: Fri Feb 2 13:06:50 2024 +0530
PHOENIX-7008: Fix for parser gap and fix for failing test (#1812)
---
.../src/it/java/org/apache/phoenix/end2end/CDCMiscIT.java | 10 --
phoenix-core/src/main/antlr3/PhoenixSQL.g | 3 ++-
.../test/java/org/apache/phoenix/parse/QueryParserTest.java| 4
3 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CDCMiscIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CDCMiscIT.java
index be35bcbf46..c8cff782d7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CDCMiscIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CDCMiscIT.java
@@ -139,16 +139,6 @@ public class CDCMiscIT extends ParallelStatsDisabledIT {
assertEquals(SQLExceptionCode.TABLE_UNDEFINED.getErrorCode(),
e.getErrorCode());
}
-try {
-conn.createStatement().execute("CREATE CDC " + cdcName
-+ " ON " + tableName + " INCLUDE (abc)");
-fail("Expected to fail due to invalid INCLUDE");
-} catch (SQLException e) {
-
assertEquals(SQLExceptionCode.UNKNOWN_INCLUDE_CHANGE_SCOPE.getErrorCode(),
-e.getErrorCode());
-assertTrue(e.getMessage().endsWith("abc"));
-}
-
String cdc_sql = "CREATE CDC " + cdcName + " ON " + tableName;
createAndWait(conn, tableName, cdcName, cdc_sql);
assertCDCState(conn, cdcName, null, 3);
diff --git a/phoenix-core/src/main/antlr3/PhoenixSQL.g
b/phoenix-core/src/main/antlr3/PhoenixSQL.g
index 737ef4aabf..feb8a19ba6 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -84,6 +84,7 @@ tokens
CDC='cdc';
PRE='pre';
POST='post';
+CHANGE='change';
LATEST='latest';
ALL='all';
INDEX='index';
@@ -583,7 +584,7 @@ cdc_change_scopes returns [Set ret]
;
cdc_change_scope returns [CDCChangeScope ret]
-: v=(PRE | POST | LATEST | ALL)
+: v=(PRE | POST | CHANGE)
{
ret = CDCChangeScope.valueOf(v.getText().toUpperCase());
}
diff --git
a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
index 71020bb659..23f147473a 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
@@ -520,6 +520,10 @@ public class QueryParserTest {
stmt = parseCreateCDCSimple("create cdc foo on bar include (pre)",
false);
assertEquals(new HashSet<>(Arrays.asList(PTable.CDCChangeScope.PRE)),
stmt.getIncludeScopes());
+stmt = parseCreateCDCSimple("create cdc foo on bar include (pre, post,
change)", false);
+assertEquals(new HashSet<>(Arrays.asList(PTable.CDCChangeScope.PRE,
+PTable.CDCChangeScope.POST,
PTable.CDCChangeScope.CHANGE)),
+stmt.getIncludeScopes());
stmt = parseCreateCDCSimple("create cdc foo on bar include (pre, pre,
post)",
false);
assertEquals(new HashSet<>(Arrays.asList(PTable.CDCChangeScope.PRE,