Commit 5678fc2
authored
fix(bqjdbc): resolve JDBC metadata compliance gaps for wrappers, searchability, and type mappings (#13242)
b/514445832
### Key Changes
1. **Align DatabaseMetaData Column Data Types and DB-Specific Type
Names**:
* Updated `DatabaseMetaData.getColumns()` type resolution (via
`mapBigQueryTypeToJdbc`) to map BigQuery types and database-specific
type names compliantly (e.g., `STRING`, `RANGE`, `GEOGRAPHY`, `JSON`,
`INTERVAL`).
* Aligned type codes with JDBC conventions (e.g.,
`StandardSQLTypeName.STRING` maps to `Types.NVARCHAR` to support
Unicode/UTF-8 string reporting).
* Ensured that unknown/fallback types default to `Types.NVARCHAR` /
`STRING` instead of `Types.VARCHAR` to keep mapping behavior consistent
across the driver.
* Documented design rationale for mapping `StandardSQLTypeName.STRING`
to `Types.NVARCHAR` (UTF-8 character encoding reporting).
2. **Wrapper Pattern Implementation (JDBC 4.0 Compliance)**:
* Implemented standard JDBC wrapper methods (`unwrap` and
`isWrapperFor`) in `BigQueryDatabaseMetaData` and
`BigQueryResultSetMetadata`.
* Integrated proxy resolution via `BigQueryJdbcContextProxy` to
correctly handle unwrapping in connection proxy environments.
3. **ResultSetMetaData Searchability**:
* Refactored `BigQueryResultSetMetadata.isSearchable` to return `true`
for all column types. This fixes compliance issues where advanced types
(`GEOGRAPHY`, `JSON`, `INTERVAL`, `RANGE` under `Types.OTHER`) were
incorrectly reported as not searchable, even though they are fully
queryable.1 parent d08691a commit 5678fc2
5 files changed
Lines changed: 175 additions & 72 deletions
File tree
- java-bigquery/google-cloud-bigquery-jdbc/src
- main/java/com/google/cloud/bigquery/jdbc
- test/java/com/google/cloud/bigquery/jdbc
Lines changed: 61 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
1650 | 1652 | | |
1651 | 1653 | | |
1652 | 1654 | | |
1653 | | - | |
1654 | | - | |
| 1655 | + | |
| 1656 | + | |
1655 | 1657 | | |
1656 | 1658 | | |
1657 | 1659 | | |
| |||
1664 | 1666 | | |
1665 | 1667 | | |
1666 | 1668 | | |
1667 | | - | |
| 1669 | + | |
1668 | 1670 | | |
1669 | 1671 | | |
1670 | | - | |
| 1672 | + | |
1671 | 1673 | | |
1672 | 1674 | | |
1673 | 1675 | | |
| |||
4750 | 4752 | | |
4751 | 4753 | | |
4752 | 4754 | | |
4753 | | - | |
4754 | | - | |
| 4755 | + | |
| 4756 | + | |
| 4757 | + | |
| 4758 | + | |
| 4759 | + | |
4755 | 4760 | | |
4756 | 4761 | | |
4757 | 4762 | | |
4758 | | - | |
4759 | | - | |
| 4763 | + | |
| 4764 | + | |
4760 | 4765 | | |
4761 | 4766 | | |
4762 | 4767 | | |
| |||
4828 | 4833 | | |
4829 | 4834 | | |
4830 | 4835 | | |
| 4836 | + | |
| 4837 | + | |
| 4838 | + | |
| 4839 | + | |
| 4840 | + | |
| 4841 | + | |
| 4842 | + | |
| 4843 | + | |
| 4844 | + | |
| 4845 | + | |
| 4846 | + | |
| 4847 | + | |
| 4848 | + | |
| 4849 | + | |
| 4850 | + | |
| 4851 | + | |
| 4852 | + | |
| 4853 | + | |
| 4854 | + | |
| 4855 | + | |
| 4856 | + | |
| 4857 | + | |
| 4858 | + | |
| 4859 | + | |
| 4860 | + | |
| 4861 | + | |
| 4862 | + | |
| 4863 | + | |
| 4864 | + | |
| 4865 | + | |
| 4866 | + | |
| 4867 | + | |
| 4868 | + | |
| 4869 | + | |
| 4870 | + | |
| 4871 | + | |
| 4872 | + | |
| 4873 | + | |
| 4874 | + | |
| 4875 | + | |
| 4876 | + | |
4831 | 4877 | | |
4832 | 4878 | | |
4833 | | - | |
4834 | | - | |
| 4879 | + | |
| 4880 | + | |
4835 | 4881 | | |
4836 | | - | |
4837 | | - | |
4838 | | - | |
4839 | | - | |
4840 | | - | |
4841 | | - | |
4842 | | - | |
4843 | | - | |
4844 | | - | |
4845 | | - | |
4846 | | - | |
4847 | | - | |
4848 | | - | |
4849 | | - | |
4850 | | - | |
4851 | | - | |
4852 | | - | |
4853 | | - | |
4854 | | - | |
4855 | | - | |
4856 | | - | |
4857 | | - | |
4858 | | - | |
4859 | | - | |
4860 | | - | |
4861 | | - | |
4862 | | - | |
4863 | | - | |
4864 | | - | |
4865 | | - | |
4866 | | - | |
4867 | | - | |
4868 | | - | |
4869 | | - | |
4870 | | - | |
| 4882 | + | |
| 4883 | + | |
| 4884 | + | |
| 4885 | + | |
4871 | 4886 | | |
| 4887 | + | |
4872 | 4888 | | |
4873 | 4889 | | |
4874 | 4890 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
74 | 73 | | |
75 | 74 | | |
76 | 75 | | |
77 | | - | |
78 | | - | |
| 76 | + | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
| |||
205 | 203 | | |
206 | 204 | | |
207 | 205 | | |
208 | | - | |
| 206 | + | |
209 | 207 | | |
210 | 208 | | |
211 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
212 | 213 | | |
213 | 214 | | |
214 | 215 | | |
215 | 216 | | |
216 | | - | |
| 217 | + | |
217 | 218 | | |
218 | 219 | | |
0 commit comments