goccy / bigquery-emulator

BigQuery emulator server implemented in Go
MIT License
845 stars 108 forks source link

Cannot create a view with a query that ends in semicolon #300

Open ohaibbq opened 7 months ago

ohaibbq commented 7 months ago

What happened?

failed to parse statements: failed to parse statement: INVALID_ARGUMENT: Syntax error: Expected ")" but got ";" [type.googleapis.com/zetasql.ErrorLocation='\x08\x07\x10.']

What did you expect to happen?

View to be created successfully

How can we reproduce it (as minimally and precisely as possible)?


    if err := view.Create(ctx, &bigquery.TableMetadata{
        Name: viewName,
        ViewQuery: `WITH table_rows AS (
                    SELECT "Blueberry Muffins" AS item, 2 AS orders
                )
                SELECT item, COUNT(*) AS total_count
                FROM table_rows
                GROUP BY item, orders
                ORDER BY item;`,
    }); err != nil {
        t.Fatal(err)
    }

Anything else we need to know?

No response