Skip to content

Commit

Permalink
[DDL] Skipping mat tables (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 authored Dec 20, 2024
1 parent 8fb5664 commit 09aa180
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/antlr/create_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions lib/antlr/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 09aa180

Please sign in to comment.