Skip to content

feat: handle auto pagination for BigQuery v2 #3829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 20, 2025

Conversation

PhongChuong
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, please read our contributing guidelines.

There are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes # b/360114900 & b/352331075

@product-auto-label product-auto-label bot added the size: l Pull request size is large. label Jun 6, 2025
@PhongChuong PhongChuong marked this pull request as draft June 6, 2025 14:54
@PhongChuong PhongChuong marked this pull request as ready for review June 6, 2025 15:56
@PhongChuong
Copy link
Contributor Author

I'm unsure which checks are relevant/needed. Please let me know,
Thank you,

@blakeli0
Copy link
Collaborator

blakeli0 commented Jun 9, 2025

/gcbrun

PAGINATE_MAX_RESULT_TYPES =
ImmutableMap.of(
"com.google.cloud.bigquery.v2",
ImmutableMap.of(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess there are some legacy RPCs use max_results field and are not of wrapper types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there are total of 4 types. 2 wrapper types [UINT32VALUE, INT32VALUE] and 2 non wrapper type [uint32, int32].

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks! I think my question is more like do we need the value of the map to be another map (compared to a set) that contains the actual types? Looks like all the legacy RPCs are using wrapper types.

@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Jun 11, 2025
Copy link
Contributor Author

@PhongChuong PhongChuong left a comment

Choose a reason for hiding this comment

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

Thanks for the review. PTAL.

PAGINATE_MAX_RESULT_TYPES =
ImmutableMap.of(
"com.google.cloud.bigquery.v2",
ImmutableMap.of(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there are total of 4 types. 2 wrapper types [UINT32VALUE, INT32VALUE] and 2 non wrapper type [uint32, int32].

Path serviceYamlPath = Paths.get(testFilesDirectory, serviceYamlFilename);
Optional<com.google.api.Service> serviceYamlOpt =
ServiceYamlParser.parse(serviceYamlPath.toString());
assertTrue(serviceYamlOpt.isPresent());
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think service yaml and service config json may not be required in this case? Can we pass empty ones to simplify the test cas?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted service.yaml but it seems like config json is still needed.

PAGINATE_MAX_RESULT_TYPES =
ImmutableMap.of(
"com.google.cloud.bigquery.v2",
ImmutableMap.of(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks! I think my question is more like do we need the value of the map to be another map (compared to a set) that contains the actual types? Looks like all the legacy RPCs are using wrapper types.

@@ -149,6 +149,23 @@ public abstract class AbstractServiceStubSettingsClassComposer implements ClassC

private final TransportContext transportContext;

// Maps of package->methodName to types for pagination with max_results field.
private static final ImmutableMap<String, ImmutableMap<String, TypeNode>>
PAGINATE_MAX_RESULT_TYPES =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make the name of this static field more bigquery specific? Same comment for PAGINATION_MAX_RESULTS_SERVICES_ALLOWLIST below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. PTAL.
I've also updated the dictionary to be a single map of types instead of map to map. Using a set is not possible because unwrapping requires to differentiate the 2 wrapper types.

// in reverse chronological order, by job creation time. Requires the Can View
// project role, or the Is Owner project role if you set the allUsers
// property.
rpc ListJobs(ListJobsRequest) returns (JobList) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mind adding another test case here that is outside of the hardcoded list? To prove that other RPCs are not affected even if they are under the bigquery namespace?

Copy link
Contributor Author

@PhongChuong PhongChuong Jun 17, 2025

Choose a reason for hiding this comment

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

Added deleteJob rpc as additional test case. PTAL.

@PhongChuong
Copy link
Contributor Author

@blakeli0 , thank you for the review. I've updated the PR to include your suggestions. PTAL.

@blakeli0
Copy link
Collaborator

/gcbrun

@blakeli0
Copy link
Collaborator

/gcbrun

@blakeli0
Copy link
Collaborator

/gcbrun

@blakeli0 blakeli0 merged commit 025c84c into googleapis:main Jun 20, 2025
37 of 39 checks passed
lqiu96 pushed a commit that referenced this pull request Jun 23, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>2.60.0</summary>

##
[2.60.0](v2.59.2...v2.60.0)
(2025-06-23)


### Features

* handle auto pagination for BigQuery v2
([#3829](#3829))
([025c84c](025c84c))


### Dependencies

* update google auth library dependencies to v1.37.1
([#3846](#3846))
([ea1d9e5](ea1d9e5))
* update google http client dependencies to v1.47.1
([#3848](#3848))
([a9a39d7](a9a39d7))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants