Я пытаюсь выполнить запрос ниже -
select prd_cat, product_category from
(
select split( product_category,".") as prd_cat,product_category from
test_dataset.cosme_raw_table
where product_link = "XXX"
) as a
group by prd_cat,product_category;
, когда я запустил его с помощью веб-интерфейса BigQuery, он запустился успешно, но когда я попытался запустить его с помощью BigQuery Query API, произошел сбой с сообщением об ошибке «Группировка повыражения типа ARRAY недопустимы в [6:10] "Ниже мой код -
String query = "select prd_cat, product_category" +
" from\n" +
"(\n" +
"select split( product_category,\".\") as prd_cat," +
"product_category " +
"from test_dataset.cosme_raw_table \n" +
"where product_link = \"XXX\"\n" +
") as a\n" +
"group by prd_cat,product_category";
QueryJobConfiguration queryJobConfiguration =
QueryJobConfiguration.newBuilder(query)
.setDestinationTable(tableId1)
.setWriteDisposition(JobInfo.WriteDisposition.WRITE_TRUNCATE)
.build();
Job loadJob1 = bigquery.create(JobInfo.of(queryJobConfiguration));
Ниже приведены журналы -
com.google.cloud.bigquery.BigQueryException: Grouping by expressions of type ARRAY is not allowed at [6:10]
at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.translate(HttpBigQueryRpc.java:99)
at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.getQueryResults(HttpBigQueryRpc.java:401)
at com.google.cloud.bigquery.BigQueryImpl$23.call(BigQueryImpl.java:688)
at com.google.cloud.bigquery.BigQueryImpl$23.call(BigQueryImpl.java:683)
at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:89)
at com.google.cloud.RetryHelper.run(RetryHelper.java:74)
at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:51)
at com.google.cloud.bigquery.BigQueryImpl.getQueryResults(BigQueryImpl.java:682)
at com.google.cloud.bigquery.BigQueryImpl.getQueryResults(BigQueryImpl.java:674)
at com.google.cloud.bigquery.Job$1.call(Job.java:329)
at com.google.cloud.bigquery.Job$1.call(Job.java:326)
at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:89)
at com.google.cloud.RetryHelper.run(RetryHelper.java:74)
at com.google.cloud.RetryHelper.poll(RetryHelper.java:63)
at com.google.cloud.bigquery.Job.waitForQueryResults(Job.java:325)
at com.google.cloud.bigquery.Job.waitFor(Job.java:240)
at TestBigQuery.explicit(TestBigQuery.java:190)
at TestBigQuery.main(TestBigQuery.java:32)
Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"location" : "parameters.q",
"message" : "Grouping by expressions of type ARRAY is not allowed at [6:10]",
"reason" : "invalidQuery"
} ],
"message" : "Grouping by expressions of type ARRAY is not allowed at [6:10]",
"status" : "INVALID_ARGUMENT"
}
Может кто-нибудь, пожалуйста, помогите.Спасибо !!