Skip to content

Commit 082b046

Browse files
feat(bigquery-jdbc): Migrate getImportedKeys and getCrossReference to BQ API (#13692)
b/532249777 This PR migrates the `getImportedKeys` and `getCrossReference` JDBC metadata methods in `BigQueryDatabaseMetaData` to retrieve constraints natively via the Google Cloud Java Client API instead of running legacy raw SQL files on BigQuery. ## Changes ### **API-based Implementations** - Migrated `getImportedKeys(...)` to fetch and scan foreign keys from standard table definitions. - Migrated `getCrossReference(...)` to matching parent and foreign table references using client-side definitions. - Utilized the shared parallel table processor utilities (`processTargetTablesConcurrently(...)` and `processSingleTable(...)`) to run dataset scans concurrently. ### **Sorting & Correctness** - Separated sorting behavior according to the JDBC specification: - `getImportedKeys` is sorted by parent table: `PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, KEY_SEQ`. Introduced `definePkTableSortComparator` for this. - `getCrossReference` (and future `getExportedKeys`) is sorted by child table: `FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, KEY_SEQ`. Uses `defineFkTableSortComparator`. - Introduced a private helper `matchesOrNullWildcard(...)` to simplify and clean up catalog/schema bounds comparisons.
1 parent 24241c9 commit 082b046

5 files changed

Lines changed: 358 additions & 313 deletions

File tree

0 commit comments

Comments
 (0)