Commit 203a91e
fix(bqjdbc): pass rowsInPage with TableResult (#13238)
b/511229401
This PR introduces the `rowsInPage` metadata to `TableResult` and
ensures it is populated for all pages (both the first page and
subsequent pages fetched via pagination).
Previously, metadata about the number of rows in the page was not easily
accessible or propagated across multiple paginated requests (e.g., when
calling `getNextPage()`). This change:
1. Adds a `rowsInPage` field and builder method to the `@AutoValue`
`TableResult` class.
2. Populates `rowsInPage` during initial page creation in `BigQueryImpl`
and empty results in `Job.java`.
3. Updates `TableResult.getNextPage()` to calculate the size of values
for subsequent pages via `Iterables.size` (which is $O(1)$ for
materialized lists) and sets it on the returned `TableResult` pages.
4. Updates unit test assertions in `TableResultTest.java` and
`SerializationTest.java` to verify that `rowsInPage` is populated and
propagated correctly.
## Key Changes
- **`TableResult.java`**: Added `getRowsInPage()`, builder method
`setRowsInPage()`, and updated `getNextPage()` to pass down the
calculated row count for the next page.
- **`BigQueryImpl.java`**: Set `rowsInPage` on initial query results
page creation.
- **`TableResultTest.java`**: Added assertions to verify that
`rowsInPage` is correctly populated for both the first page and
subsequent pages.
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>1 parent da1ccb1 commit 203a91e
6 files changed
Lines changed: 33 additions & 5 deletions
File tree
- java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc
- java-bigquery/google-cloud-bigquery/src
- main/java/com/google/cloud/bigquery
- test/java/com/google/cloud/bigquery
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1028 | 1028 | | |
1029 | 1029 | | |
1030 | 1030 | | |
1031 | | - | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
1032 | 1034 | | |
1033 | 1035 | | |
1034 | 1036 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1691 | 1691 | | |
1692 | 1692 | | |
1693 | 1693 | | |
| 1694 | + | |
1694 | 1695 | | |
1695 | 1696 | | |
1696 | 1697 | | |
| |||
2022 | 2023 | | |
2023 | 2024 | | |
2024 | 2025 | | |
| 2026 | + | |
2025 | 2027 | | |
2026 | 2028 | | |
2027 | 2029 | | |
| |||
2041 | 2043 | | |
2042 | 2044 | | |
2043 | 2045 | | |
| 2046 | + | |
2044 | 2047 | | |
2045 | 2048 | | |
2046 | 2049 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
| 427 | + | |
427 | 428 | | |
428 | 429 | | |
429 | 430 | | |
| |||
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
84 | 90 | | |
85 | 91 | | |
86 | 92 | | |
| |||
94 | 100 | | |
95 | 101 | | |
96 | 102 | | |
| 103 | + | |
| 104 | + | |
97 | 105 | | |
98 | 106 | | |
99 | 107 | | |
100 | | - | |
| 108 | + | |
101 | 109 | | |
102 | 110 | | |
| 111 | + | |
103 | 112 | | |
104 | 113 | | |
105 | 114 | | |
| |||
137 | 146 | | |
138 | 147 | | |
139 | 148 | | |
| 149 | + | |
140 | 150 | | |
141 | 151 | | |
142 | 152 | | |
143 | 153 | | |
144 | 154 | | |
145 | | - | |
| 155 | + | |
| 156 | + | |
146 | 157 | | |
147 | 158 | | |
148 | 159 | | |
| |||
158 | 169 | | |
159 | 170 | | |
160 | 171 | | |
161 | | - | |
| 172 | + | |
| 173 | + | |
162 | 174 | | |
163 | 175 | | |
java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/SerializationTest.java
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
213 | 214 | | |
214 | 215 | | |
215 | 216 | | |
| |||
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| 74 | + | |
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
| |||
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
| 90 | + | |
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
87 | 94 | | |
| 95 | + | |
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
| |||
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
| 106 | + | |
98 | 107 | | |
99 | 108 | | |
100 | 109 | | |
| |||
0 commit comments