Skip to content

[TASK-252] Temporal Types CPP#266

Open
fresh-borzoni wants to merge 2 commits intoapache:mainfrom
fresh-borzoni:cpp-temporal
Open

[TASK-252] Temporal Types CPP#266
fresh-borzoni wants to merge 2 commits intoapache:mainfrom
fresh-borzoni:cpp-temporal

Conversation

@fresh-borzoni
Copy link
Contributor

@fresh-borzoni fresh-borzoni commented Feb 6, 2026

Summary

closes #252

  • Add temporal type support (Date, Time, Timestamp, TimestampLtz) to C++ bindings — both write and read paths
  • C++ wrapper types (Date, Time, Timestamp) with factory methods (FromYMD, FromHMS, FromTimePoint, etc.) and decomposition accessors
  • Write path packs temporal values into existing FfiDatum fields (no struct changes)
  • Read path uses Fluss table schema to disambiguate TimestampNtz vs TimestampLtz (Arrow loses this distinction)
  • Pre-compute projected columns (aligned with Python bindings approach) so projection works correctly with temporal type disambiguation
  • DatumType values 11–14 for temporal types (8–10 reserved for decimal PR)

@fresh-borzoni
Copy link
Contributor Author

@luoyuxia @zhaohaidao
Appreciate your review here. PTAL 🙏

Copy link

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

Adds end-to-end temporal type (Date/Time/Timestamp/TimestampLtz) support to the C++ bindings by introducing C++ wrapper types and extending the Rust<->C++ FFI conversions to correctly encode/decode temporal values, including LTZ vs NTZ disambiguation during reads (including projected scans).

Changes:

  • Add temporal DatumType values and map them on the Rust FFI conversion paths (row->core and core->row).
  • Disambiguate TimestampNtz vs TimestampLtz on the read path using the Fluss schema columns (and keep this correct under projection).
  • Introduce C++ Date/Time/Timestamp wrapper types and extend the C++ example to exercise temporal writes/reads and projection.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
bindings/cpp/src/types.rs Adds temporal datum types and packs/unpacks Arrow temporal arrays into existing FfiDatum fields; uses schema columns to distinguish NTZ vs LTZ.
bindings/cpp/src/lib.rs Tracks projected columns in LogScanner and passes them into scan-record conversion to keep temporal disambiguation correct under projection.
bindings/cpp/src/table.cpp Implements Date decomposition/factory functions used by the C++ API.
bindings/cpp/include/fluss.hpp Adds C++ temporal wrapper types plus Datum/GenericRow helpers for temporal values.
bindings/cpp/examples/example.cpp Extends example to write/read temporal columns and validate type behavior under full scan and projection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fresh-borzoni
Copy link
Contributor Author

added macro for correct time functions and out of bounds check

@zhaohaidao
Copy link
Contributor

@fresh-borzoni Thanks for your pr. LGTM

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.

Temporal types support in CPP

2 participants