-
-
Notifications
You must be signed in to change notification settings - Fork 150
Description
What happened?
When testing with an EXPORT DATA statement, the query can’t be executed because:
INVALID_ARGUMENT: Statement not supported: ExportDataStatement [at 1:1]
I guess the statement should be intercepted because obviously sqlite can't export to GCS, while the code for exporting and importing data to and from GCS is implemented in big query-emulator (exportToGCS/importFromGCS).
To be clear, if I make a toy example using go-zetasql:
stmt, err := zetasql.ParseStatement("EXPORT DATA OPTIONS(uri='gs://test.csv', format='csv') AS (SELECT * FROM my_dataset.my_table);", nil)
and walk the resulting AST everything is fine so there should not be a problem with the SQL parsing (so the error is wrong).
Indeed, using zetasqlite it will panic with:
panic: failed to analyze: INVALID_ARGUMENT: Statement not supported: ExportDataStatement [at 1:1]
The problem is that this statement should be intercepted and the 'AS (...)' subexpression passed to zetasqlite to fetch the data, while the 'EXPORT STATEMENT' should be handled internally by bigquery-emulator (the code is there).
What did you expect to happen?
EXPORT DATA should export to GCS.
How can we reproduce it (as minimally and precisely as possible)?
bq --project_id test query "EXPORT DATA OPTIONS(uri='gs://test-bucket/test.csv', format='csv') AS (SELECT 1);"
Anything else we need to know?
No response