Skip to content

Commit 87b5527

Browse files
gopalldbclaude
andauthored
Normalize TIMESTAMP_NTZ to TIMESTAMP in Thrift path for metadata consistency (databricks#1182)
## Summary This PR adds TIMESTAMP_NTZ normalization in the Thrift path to ensure consistent metadata behavior across both SEA and Thrift API paths. ## Background PR databricks#1177 moved Arrow metadata extraction earlier in the processing pipeline, which exposed an inconsistency: the Thrift path started returning the correct "TIMESTAMP_NTZ" from server metadata, while the SEA path was already normalizing it to "TIMESTAMP" for backward compatibility. ## Changes - Added TIMESTAMP_NTZ → TIMESTAMP normalization in `DatabricksResultSetMetaData.java` Thrift constructor (lines 205-208) - This brings Thrift path behavior in line with existing SEA path normalization - Fixes test failure in `PreparedStatementIntegrationTests.testGetMetaData_NoResultSet` ## Testing - ✅ Local test run: `PreparedStatementIntegrationTests.testGetMetaData_NoResultSet` passes - ✅ Metadata now consistent before and after `executeQuery()` for TIMESTAMP_NTZ columns - ✅ Both SEA and Thrift paths return "TIMESTAMP" for TIMESTAMP_NTZ columns ## Related - Builds on PR databricks#1177 (Fix Arrow field metadata not available for queries with 0 rows) - Fixes issue introduced by early metadata extraction in PR databricks#1177 - Maintains backward compatibility with existing behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 4310e77 commit 87b5527

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
### Fixed
1111
- Fixed complex data type metadata support when retrieving 0 rows in Arrow format
12+
- Normalized TIMESTAMP_NTZ to TIMESTAMP in Thrift path for consistency with SEA behavior
1213

1314
---
1415
*Note: When making changes, please add your change under the appropriate section

src/main/java/com/databricks/jdbc/api/impl/DatabricksResultSetMetaData.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ public DatabricksResultSetMetaData(
201201
&& arrowMetadata.get(columnIndex) != null)
202202
? arrowMetadata.get(columnIndex)
203203
: getTypeTextFromTypeDesc(columnDesc.getTypeDesc());
204+
205+
// Normalize TIMESTAMP_NTZ to TIMESTAMP for consistency with SEA path
206+
if (columnTypeText != null && columnTypeText.equalsIgnoreCase(TIMESTAMP_NTZ)) {
207+
columnTypeText = TIMESTAMP;
208+
}
209+
204210
columnBuilder
205211
.columnName(columnInfo.getName())
206212
.columnTypeClassName(

0 commit comments

Comments
 (0)