Skip to content

FIX: Update time handling in Arrow integration to include fractional seconds#499

Open
ffelixg wants to merge 1 commit intomicrosoft:mainfrom
ffelixg:arrow_fetch_time_fraction
Open

FIX: Update time handling in Arrow integration to include fractional seconds#499
ffelixg wants to merge 1 commit intomicrosoft:mainfrom
ffelixg:arrow_fetch_time_fraction

Conversation

@ffelixg
Copy link
Copy Markdown
Contributor

@ffelixg ffelixg commented Apr 7, 2026

Work Item / Issue Reference

GitHub Issue: #498


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.

Copilot AI review requested due to automatic review settings April 7, 2026 14:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_TIME2 columns to Arrow C Data interface format ttn (time64 in nanoseconds) and store values in an int64_t nanosecond buffer.
  • Include SQL_SS_TIME2_STRUCT.fraction in the computed time value (nanoseconds since midnight).
  • Update Arrow integration tests to expect pa.time64("ns") and add a fractional-seconds time(7) test case; remove the Parquet workaround that was specific to time32("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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants