You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix errors in table creation when using BIGINT, SMALLINT, TINYINT, or VOID types (#1069)
## Description
This PR fixes an issue in the Databricks JDBC driver where
`PreparedStatement.getMetaData()` would throw exceptions for certain
column types. Specifically, it now correctly handles:
- `BIGINT`
- `SMALLINT`
- `TINYINT`
- `VOID`
Previously, attempting to get metadata for these types would fail with
exceptions such as `IllegalArgumentException` or
`IllegalStateException`, preventing normal JDBC usage.
**Notes:**
- `INTERVAL` columns are not included in this fix because they cannot
currently be used in `CREATE TABLE` statements, so testing and support
are not possible at this time.
- `GEOMETRY` and `GEOGRAPHY` types are still in preview and tables with
these columns could not be created. As a result, they are not yet fully
supported by `getMetaData()`.
This change ensures that `ResultSetMetaData` is correctly returned for
all supported numeric and void types, improving compatibility and
stability for JDBC clients.
**Fixes**: [databricks-jdbc
#1064](#1064)
## Testing
The following testing was performed to validate the fix:
1. **Unit tests**
- Added tests covering tables with columns of type `BIGINT`, `SMALLINT`,
`TINYINT`, and `VOID`.
- Verified that calling `getMetaData()` does not throw exceptions and
returns the correct metadata.
2. **Manual testing**
- Created a table with a `BIGINT` column and retrieved its metadata:
```java
try (Connection conn = driver.connect(url, props)) {
try (PreparedStatement st = conn.prepareStatement("create or replace table simple_test_2856371 (col bigint)")) {
st.execute();
}
try (PreparedStatement st = conn.prepareStatement("select t.* from simple_test_2856371 as t")) {
ResultSetMetaData rsmd = st.getMetaData();
assert rsmd.getColumnCount() == 1;
assert "BIGINT".equals(rsmd.getColumnTypeName(1));
}
}
```
3. **Regression checks**
- Confirmed that other supported column types continue to return
metadata correctly.
- Verified that driver behavior remains consistent across different JDBC
operations.
- Local testing
<img width="1598" height="1039" alt="Screenshot 2025-11-08 at 19 33 10"
src="https://github.com/user-attachments/assets/444ef818-de0d-4ed8-b258-3ebd94b2a256"
/>
<img width="1598" height="1039" alt="Screenshot 2025-11-08 at 19 33 02"
src="https://github.com/user-attachments/assets/41a0bcfa-6147-45b5-9757-638b3c2b4fa8"
/>
---------
Signed-off-by: Roman Dryndik <dryndikroman@gmail.com>
Co-authored-by: Samikshya Chand <148681192+samikshya-db@users.noreply.github.com>
Copy file name to clipboardExpand all lines: NEXT_CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,5 +9,7 @@
9
9
- Minimized OAuth requests by reducing calls in feature flags and telemetry.
10
10
11
11
### Fixed
12
+
- Fixed: Errors in table creation when using BIGINT, SMALLINT, TINYINT, or VOID types.
13
+
- Fixed: PreparedStatement.getMetaData() now correctly reports TINYINT columns as Types.TINYINT (java.lang.Byte) instead of Types.SMALLINT (java.lang.Integer).
12
14
---
13
15
*Note: When making changes, please add your change under the appropriate section with a brief description.*
0 commit comments