FIX: Update time handling in Arrow integration to include fractional seconds#499
Open
ffelixg wants to merge 1 commit intomicrosoft:mainfrom
Open
FIX: Update time handling in Arrow integration to include fractional seconds#499ffelixg wants to merge 1 commit intomicrosoft:mainfrom
ffelixg wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Arrow fetch integration to preserve SQL Server TIME fractional seconds by representing time columns as Arrow time64(ns) and computing values using the full SQL_SS_TIME2_STRUCT (including fraction).
Changes:
- Map
SQL_SS_TIME2columns to Arrow C Data interface formatttn(time64 in nanoseconds) and store values in anint64_tnanosecond buffer. - Include
SQL_SS_TIME2_STRUCT.fractionin the computed time value (nanoseconds since midnight). - Update Arrow integration tests to expect
pa.time64("ns")and add a fractional-secondstime(7)test case; remove the Parquet workaround that was specific totime32("s").
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tests/test_004_cursor_arrow.py |
Updates expected Arrow time types to time64(ns), adds a fractional time(7) case, and simplifies the Parquet roundtrip validation. |
mssql_python/pybind/ddbc_bindings.cpp |
Switches Arrow time backing storage to nanoseconds (int64_t) and includes fractional seconds when materializing Arrow time values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work Item / Issue Reference
Summary
Map SQL time types to the arrow nanosecond type and include the fraction part of SQL_SS_TIME2_STRUCT in the value calculation.
For consistency, also remove the unreachable SQL_TIME and SQL_TYPE_TIME branches.