gpt4 book ai didi

java - 将 'dryRun' 设置为 true 时,BigQuery 客户端库抛出 NPE

转载 作者:行者123 更新时间:2023-11-30 10:34:34 26 4
gpt4 key购买 nike

根据 BigQuery 中 dryRun 字段的文档 API ,当设置为 true 时,查询将不会被执行,而是会验证它并返回一些基本统计信息:

[Optional] If set to true, BigQuery doesn't run the job. Instead, if the query is valid, BigQuery returns statistics about the job such as how many bytes would be processed. If the query is invalid, an error returns. The default value is false.

enter image description here

但是,使用 Java client lib for BigQuery ,并将 dryRun 设置为 true 会抛出 NullPointerException:

[...] 
JobConfiguration jobConfiguration = newBuilder(query)
.setAllowLargeResults(true)
.setUseLegacySql(false)
.setDryRun(true)
.setDestinationTable(TableId.of("<project>", "<dataset>", "<table>"))
.setCreateDisposition(CREATE_IF_NEEDED)
.setWriteDisposition(WRITE_TRUNCATE)
.setPriority(INTERACTIVE)
.build();

JobInfo jobInfo = JobInfo.of(jobConfiguration);
Job job = bigQuery.create(jobInfo);
[...]

JobConfiguration LN 140 中的异常:

Exception in thread "main" java.lang.NullPointerException
at com.google.cloud.bigquery.JobConfiguration.fromPb(JobConfiguration.java:140)
at com.google.cloud.bigquery.JobInfo$BuilderImpl.<init>(JobInfo.java:182)
at com.google.cloud.bigquery.Job.fromPb(Job.java:324)
at com.google.cloud.bigquery.BigQueryImpl.create(BigQueryImpl.java:229)

这是 Java 客户端库中的错误,还是我做错了/使用错了?

注意:将其设置为 false 会按预期工作。

注意 2:jobConfigurationjobInfo 都已初始化,即不是 null

enter image description here

最佳答案

这是客户端库中的错误。这是 GitHub 中的问题。

https://github.com/GoogleCloudPlatform/google-cloud-java/issues/525

关于java - 将 'dryRun' 设置为 true 时,BigQuery 客户端库抛出 NPE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41604995/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com