简体   繁体   中英

BigQuery Java API Convert Row to Java Object

I am using this library to interact with BigQuery API. Is there a way to convert the returned rows into a Java Object easily? Or do I have to work with the Schema and FieldValueList ?

Yes, if you are using the Java BigQuery client (which is recommended), you would need to work with the Schema and FieldValueList since they are part of the manually written layer on top of the BigQuery API. You could iterate on the object and maybe construct a new object:

for (FieldValueList values : result.iterateAll()) {
      for (FieldValue value : values) {
        for (FieldValue record : value.getRecordValue()) {
          // construct new object
      }
}

If you wish to not use Schema and FieldValueList, you can use the auto-generated BigQuery Java client library .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM