feat(bigquery-jdbc): optimize memory footprint for JSON result set streaming#13660
feat(bigquery-jdbc): optimize memory footprint for JSON result set streaming#13660Neenu1995 wants to merge 9 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces BigQueryJsonStreamParser to parse BigQuery REST JSON responses into lightweight Object[] row buffers, reducing JVM heap overhead and GC pause times. It also updates BigQueryFieldValueListWrapper and BigQueryStatement to support and utilize these lightweight row buffers. The review feedback highlights critical infinite loop vulnerabilities in the JSON parsing loops when handling truncated or abruptly ended streams, and suggests using standard Jackson parsing patterns with explicit null token checks. Additionally, the reviewer recommends chaining constructors to reduce code duplication and removing unused stream parsing methods from the production code.
| Uninterruptibles.putUninterruptibly( | ||
| bigQueryFieldValueListWrapperBlockingQueue, | ||
| BigQueryFieldValueListWrapper.of(schema.getFields(), fieldValueList)); | ||
| BigQueryFieldValueListWrapper.ofUnpackedRow( |
There was a problem hiding this comment.
We already pass schema.getFields(), so we can just move isComplexColumn to be a part of BigQueryFieldValueListWrapper.of()? So no changes in statement, changes are scoped to the object itself
| ALL_TYPES_SCHEMA_FIELDS); | ||
|
|
||
| @Test | ||
| public void testUnpackRowAndCoercionAllTypes() throws Exception { |
There was a problem hiding this comment.
nit: is there any value in this test? We already validate coercion as a part of other tests
b/529436374
BigQueryFieldValueListWrapperusing a static, stateless utility pattern to reduce object allocations during JSON result set parsing.ARRAY,STRUCT,RANGE) outside the page-fetching loop inBigQueryStatementto avoid redundant per-row inspection.FieldValuereferences for complex types (RANGE,ARRAY,STRUCT) during row unpacking to prevent improper string coercion.