Skip to content

Commit

Permalink
PHOENIX-7008: Fix for parser gap and fix for failing test (apache#1812)
Browse files Browse the repository at this point in the history
  • Loading branch information
haridsv committed Feb 2, 2024
1 parent f07898f commit 87a2ea1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
10 changes: 0 additions & 10 deletions phoenix-core/src/it/java/org/apache/phoenix/end2end/CDCMiscIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,6 @@ public void testCreate() throws Exception {
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);
Expand Down
3 changes: 2 additions & 1 deletion phoenix-core/src/main/antlr3/PhoenixSQL.g
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ tokens
CDC='cdc';
PRE='pre';
POST='post';
CHANGE='change';
LATEST='latest';
ALL='all';
INDEX='index';
Expand Down Expand Up @@ -583,7 +584,7 @@ cdc_change_scopes returns [Set<CDCChangeScope> ret]
;

cdc_change_scope returns [CDCChangeScope ret]
: v=(PRE | POST | LATEST | ALL)
: v=(PRE | POST | CHANGE)
{
ret = CDCChangeScope.valueOf(v.getText().toUpperCase());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ public void testCreateCDCSimple() throws Exception {
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,
Expand Down

0 comments on commit 87a2ea1

Please sign in to comment.