googleapis / googleapis/google-cloud-java

[java-bigquery] Schema not propagated when querying for array of structs

未关闭
#12,155 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
api: bigquery priority: p3
主要语言
Java
星标
2.1k
派生
1.2k
平均合并
1 天 23 小时
30 天内合并 PR
154

描述

#### Environment details

1. Specify the API at the beginning of the title. For example, "BigQuery: ...").
```kotlin
implementation("com.google.cloud:google-cloud-bigquery:2.41.0")
```
2. OS type and version: MacOS
3. Java version: 21

#### Steps to reproduce

1. Create a table with a repeated struct schema.
2. Query the same table, try to access the nested record fields by name. This fails because no schema is attached.

#### Code example

Reproduced here: https://github.com/FredrikMeyer/bigquery-bug/blob/main/src/test/java/no/fredrikmeyer/MainTest.java

```java
var query = "select * from my_dataset.my_table";

QueryJobConfiguration queryJobConfiguration = QueryJobConfiguration.newBuilder(query).setUseLegacySql(false).build();

var res2 = bigQuery.query(queryJobConfiguration);

res2.iterateAll().forEach(r -> {
// Prints true
System.out.println(r.hasSchema());
// Prints false, even though the schema is defined above
System.out.println(r.get("arr").getRepeatedValue().getFirst().getRecordValue().hasSchema());
});
```

#### Any additional information below

When having an array of structs, the schema does not seem to be propagated to the fields. Thanks!

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。