Skip to content

feat(bigquery): add QueryResultsFormat and ArrowSerializationOptions configurations - #13942

Open
jinseopkim0 wants to merge 9 commits into
mainfrom
feat-bigquery-arrow-config
Open

feat(bigquery): add QueryResultsFormat and ArrowSerializationOptions configurations#13942
jinseopkim0 wants to merge 9 commits into
mainfrom
feat-bigquery-arrow-config

Conversation

@jinseopkim0

@jinseopkim0 jinseopkim0 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Stacked PR 1 of 3: Exposes the public configuration API surface (QueryResultsFormat and ArrowSerializationOptions) and binds them to QueryJobConfiguration.

Note: The new classes and methods are annotated with @BetaApi to indicate that the API surface is experimental while implementation PRs (PR 2 of 3 and PR 3 of 3) are merged. The @BetaApi annotation will be removed upon completion of the final PR in the stack.

b/540476814

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for Apache Arrow serialization options in BigQuery queries by adding the ArrowSerializationOptions class, the QueryResultsFormat enum, and integrating them into QueryJobConfiguration. However, the new options are currently not mapped in QueryJobConfiguration.toPb() and QueryJobConfiguration.fromPb(), which will cause them to be silently dropped during serialization. It is recommended to implement these mappings to ensure the feature functions correctly.

@jinseopkim0
jinseopkim0 force-pushed the feat-bigquery-arrow-config branch from 4f0d80d to d43166d Compare August 7, 2026 16:13
@jinseopkim0
jinseopkim0 requested a review from lqiu96 August 7, 2026 17:12
@jinseopkim0
jinseopkim0 marked this pull request as ready for review August 7, 2026 17:12
@jinseopkim0
jinseopkim0 requested review from a team as code owners August 7, 2026 17:12
@jinseopkim0
jinseopkim0 force-pushed the feat-bigquery-arrow-config branch from d43166d to b441a9d Compare August 7, 2026 19:19
@jinseopkim0
jinseopkim0 requested a review from lqiu96 August 10, 2026 19:22
Comment on lines +108 to +109
private @Nullable String bufferCompression;
private @Nullable String picosTimestampPrecision;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's possible we can set a default value for these so they they can be non-null and we can assert that they always will be non-null? especially in the setters?

e.g. uncompressed and micro precision?

Comment on lines +117 to +131
public Builder setBufferCompression(String bufferCompression) {
this.bufferCompression = checkNotNull(bufferCompression, "bufferCompression cannot be null");
return this;
}

/**
* <b>[Beta]</b> Sets the timestamp precision for Arrow timestamp types.
*
* <p>Note: Only applies when {@link QueryResultsFormat#ARROW} is enabled. For Arrow result
* streams, this precision setting governs binary Arrow timestamp column types and takes
* precedence over {@link DataFormatOptions.TimestampFormatOptions}, which applies to default
* {@link QueryResultsFormat#STRUCT_ENCODING} JSON results.
*/
@BetaApi
public Builder setPicosTimestampPrecision(String picosTimestampPrecision) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these setters, do you think we should create enum wrappers around the options? If there is a typo in the precision on compression codec, it may fail with the apiary model

Comment on lines +29 to +38
if (options == null) {
return null;
}
com.google.api.services.bigquery.model.ArrowSerializationOptions optionsPb =
new com.google.api.services.bigquery.model.ArrowSerializationOptions();
if (options.getBufferCompression() != null) {
optionsPb.setBufferCompression(options.getBufferCompression());
}
if (options.getPicosTimestampPrecision() != null) {
optionsPb.setPicosTimestampPrecision(options.getPicosTimestampPrecision());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow the above, do you think we can just assert that the params are non-null?

Also if we set a default value for ArrowSerializationOptions's params, then I don't think we need the null checks here

*/
@BetaApi
public Builder setQueryResultsFormat(QueryResultsFormat queryResultsFormat) {
this.queryResultsFormat = queryResultsFormat;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: perhaps non-null checks here? We should be able to assert that users must pass valid values here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants