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

Fix error message when trying to read BigQuery table with dollar suffix #6515

Closed
ebyhr opened this issue Jan 5, 2021 · 1 comment · Fixed by #22050
Closed

Fix error message when trying to read BigQuery table with dollar suffix #6515

ebyhr opened this issue Jan 5, 2021 · 1 comment · Fixed by #22050
Labels
bug Something isn't working

Comments

@ebyhr
Copy link
Member

ebyhr commented Jan 5, 2021

This issue occurs when trying to access a table with $... suffix. Table test exists in this case.

trino> select * from bigquery.test."test$foo";
Query 20210105_123512_00006_ztz3k failed: Cannot read partition information from a table that is not partitioned: (project-id):test.test$foo
com.google.cloud.bigquery.BigQueryException: Cannot read partition information from a table that is not partitioned: (project-id):test.test$foo
	at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.translate(HttpBigQueryRpc.java:115)
	at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.getTable(HttpBigQueryRpc.java:287)
	at com.google.cloud.bigquery.BigQueryImpl$17.call(BigQueryImpl.java:717)
	at com.google.cloud.bigquery.BigQueryImpl$17.call(BigQueryImpl.java:714)
	at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:105)
	at com.google.cloud.RetryHelper.run(RetryHelper.java:76)
	at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:50)
	at com.google.cloud.bigquery.BigQueryImpl.getTable(BigQueryImpl.java:713)
	at io.trino.plugin.bigquery.BigQueryClient.getTable(BigQueryClient.java:67)
	at io.trino.plugin.bigquery.BigQueryMetadata.getBigQueryTable(BigQueryMetadata.java:136)
	at io.trino.plugin.bigquery.BigQueryMetadata.getTableHandle(BigQueryMetadata.java:125)
	at io.trino.metadata.MetadataManager.lambda$getTableHandle$3(MetadataManager.java:345)
	at java.base/java.util.Optional.flatMap(Optional.java:294)
	at io.trino.metadata.MetadataManager.getTableHandle(MetadataManager.java:339)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitTable(StatementAnalyzer.java:1219)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitTable(StatementAnalyzer.java:329)
	at io.trino.sql.tree.Table.accept(Table.java:53)
	at io.trino.sql.tree.AstVisitor.process(AstVisitor.java:27)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:346)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.analyzeFrom(StatementAnalyzer.java:2529)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuerySpecification(StatementAnalyzer.java:1553)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuerySpecification(StatementAnalyzer.java:329)
	at io.trino.sql.tree.QuerySpecification.accept(QuerySpecification.java:144)
	at io.trino.sql.tree.AstVisitor.process(AstVisitor.java:27)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:346)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:356)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuery(StatementAnalyzer.java:1061)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitQuery(StatementAnalyzer.java:329)
	at io.trino.sql.tree.Query.accept(Query.java:107)
	at io.trino.sql.tree.AstVisitor.process(AstVisitor.java:27)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:346)
	at io.trino.sql.analyzer.StatementAnalyzer.analyze(StatementAnalyzer.java:315)
	at io.trino.sql.analyzer.Analyzer.analyze(Analyzer.java:91)
	at io.trino.sql.analyzer.Analyzer.analyze(Analyzer.java:83)
	at io.trino.execution.SqlQueryExecution.analyze(SqlQueryExecution.java:263)
	at io.trino.execution.SqlQueryExecution.<init>(SqlQueryExecution.java:186)
	at io.trino.execution.SqlQueryExecution$SqlQueryExecutionFactory.createQueryExecution(SqlQueryExecution.java:768)
	at io.trino.dispatcher.LocalDispatchQueryFactory.lambda$createDispatchQuery$0(LocalDispatchQueryFactory.java:129)
	at io.trino.$gen.Trino_testversion____20210105_123123_3.call(Unknown Source)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
GET https://www.googleapis.com/bigquery/v2/projects/(project-id)/datasets/test/tables/test$foo?prettyPrint=false
{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "Cannot read partition information from a table that is not partitioned: (project-id):test.test$foo",
    "reason" : "invalid"
  } ],
  "message" : "Cannot read partition information from a table that is not partitioned: (project-id):test.test$foo",
  "status" : "INVALID_ARGUMENT"
}
	at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:149)
	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:112)
	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:39)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:443)
	at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1108)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:541)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:474)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:591)
	at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.getTable(HttpBigQueryRpc.java:285)
	... 43 more
trino> select * from bigquery.test."test_part$__PARTITIONS_SUMMARY__";
Query 20210105_125411_00000_rrxm5 failed: Partition key is invalid: __partitions_summary__

If the table doesn't exist (xxx in this case), it returns the right message.

trino> select * from bigquery.test."xxx$foo";
Query 20210105_123532_00007_ztz3k failed: line 1:15: Table 'bigquery.test.xxx$foo' does not exist
@findepi findepi added the bug Something isn't working label Jan 5, 2021
@findepi
Copy link
Member

findepi commented Jan 5, 2021

This reminds me of #5664.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants