From 09aa180115417118b9c4d0a4d22ca3ed32912940 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Fri, 20 Dec 2024 13:10:45 -0800 Subject: [PATCH] [DDL] Skipping mat tables (#628) --- lib/antlr/create_table_test.go | 6 ++++++ lib/antlr/parse.go | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/lib/antlr/create_table_test.go b/lib/antlr/create_table_test.go index e2aa770d..90562bca 100644 --- a/lib/antlr/create_table_test.go +++ b/lib/antlr/create_table_test.go @@ -8,6 +8,12 @@ import ( ) func TestCreateTable(t *testing.T) { + { + // Skip parsing materialized tables + events, err := Parse(`CREATE TABLE high_salary_employees_mat AS SELECT name, position, salary FROM employees WHERE salary > 100000;`) + assert.NoError(t, err) + assert.Len(t, events, 0) + } { { // Create table LIKE by specifying schema diff --git a/lib/antlr/parse.go b/lib/antlr/parse.go index 6a44a52f..df78e5a9 100644 --- a/lib/antlr/parse.go +++ b/lib/antlr/parse.go @@ -86,6 +86,11 @@ func visit(tree antlr.Tree) ([]Event, error) { case *generated.RenameTableContext: return processRenameTable(ctx) case + *generated.StartTransactionContext, + *generated.CreateViewContext, + *generated.DropViewContext, + // [*generated.QueryCreateTableContext] refers to materialized tables + *generated.QueryCreateTableContext, *generated.CreateIndexContext, *generated.DropIndexContext, *generated.CreateEventContext,