Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigQuery Dialect - CREATE TABLE CLONE and COPY #141

Open
jrbangit opened this issue Jun 13, 2023 · 2 comments
Open

BigQuery Dialect - CREATE TABLE CLONE and COPY #141

jrbangit opened this issue Jun 13, 2023 · 2 comments

Comments

@jrbangit
Copy link

jrbangit commented Jun 13, 2023

Hi, All

just wondering if there is a support coming for these bigquery statements?

CREATE TABLE `tbl`
CLONE `src_tbl`;
CREATE TABLE `tbl`
COPY `src_tbl`

reference: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_copy

currently, I'm encountering this limitation below.

com.google.zetasql.SqlException: CREATE TABLE CLONE is not supported [at 4:7]

edit: it seems COPY is supported, only CLONE is not supported.

Thank you!

@matthewcbrown
Copy link
Collaborator

Support in the evaluator is not likely, but it is supported in the various other api calls (Analyzer.java).

You may need to modify the LanguageOptions to enable the statements you need enabled:
You can see an example here:

public void analyzeStatement_supportsStatementKinds() {

AnalyzerOptions analyzerOptions = new AnalyzerOptions();
analyzerOptions
    .getLanguageOptions()
    .setSupportedStatementKinds(ImmutableSet.of(ResolvedNodeKind.RESOLVED_CREATE_TABLE_STMT));
Analyzer.analyzeStatement(sql, analyzerOptions, new SimpleCatalog(""))

@pratnaparkhi2000
Copy link

pratnaparkhi2000 commented Feb 5, 2024

Hi,
CLONE query works for me.

CREATE TABLE <project_id>.<dataset_name>.<cloned_table_name>
CLONE <project_id>.<dataset_name>.<original_table_name> FOR SYSTEM_TIME AS OF CURRENT_TIMESTAMP();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants