bigQuery.create(DatasetInfo.of("temp"));
bigQuery.create(TableInfo.of(TableId.of("temp", "countries"), StandardTableDefinition.of(
Schema.of(Field.newBuilder("name", StandardSQLTypeName.STRING).build())
)));
bigQuery.create(TableInfo.of(TableId.of("temp", "my_view"), ViewDefinition.of(
"with recursive all_countries as (select * from temp.countries)\n" +
"select * from all_countries"
)));
Will lead to an exception
com.google.cloud.bigquery.BigQueryException: failed to create view CREATE VIEW `test-project.temp.my_view` AS (with recursive all_countries as (select * from temp.countries)
select * from all_countries): failed to analyze: INVALID_ARGUMENT: RECURSIVE is not supported in the WITH clause [at 1:45]
at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.translate(HttpBigQueryRpc.java:115)
at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.create(HttpBigQueryRpc.java:187)
at com.google.cloud.bigquery.BigQueryImpl$2.call(BigQueryImpl.java:300)
at com.google.cloud.bigquery.BigQueryImpl$2.call(BigQueryImpl.java:297)
at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:103)
at com.google.cloud.RetryHelper.run(RetryHelper.java:76)
at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:50)
at com.google.cloud.bigquery.BigQueryImpl.create(BigQueryImpl.java:296)
But if you execute the same SQL in BigQuery, everything will be successful
CREATE VIEW `temp.my_view` AS (
with recursive all_countries as (select * from temp.countries)
select * from all_countries
);
Steps to reproduce
Will lead to an exception
But if you execute the same SQL in BigQuery, everything will be successful