Skip to content

feat: add DateTime sentinel value support to test_sentinel_value_approach#444

Open
vincent-herlemont wants to merge 1 commit into
mainfrom
feature/datetime-sentinel-support
Open

feat: add DateTime sentinel value support to test_sentinel_value_approach#444
vincent-herlemont wants to merge 1 commit into
mainfrom
feature/datetime-sentinel-support

Conversation

@vincent-herlemont

Copy link
Copy Markdown
Owner

Summary

  • Added DateTime wrapper with ToKey implementation for sentinel value pattern
  • Replaced NaiveDate with DateTime for better precision and chrono compatibility
  • Added helper function and constant for sentinel date creation
  • Updated test to demonstrate queryable date/time "null" values

Changes

  • DateTimeWrapper struct: Implements ToKey using timestamp_millis() method
  • SENTINEL_DATE_TIMESTAMP constant: Defined timestamp for year 1000 as sentinel
  • create_sentinel_date() helper: Encapsulates sentinel date creation
  • Updated test data: Uses proper DateTime values with timestamps
  • Enhanced test coverage: Demonstrates date range queries with sentinels

Benefits

  • Follows the official chrono DateTime example pattern from codebase docs
  • Enables efficient querying of date/time fields with "null" representation
  • Avoids Option limitations where None values can't be indexed/queried
  • Provides better precision with millisecond timestamps vs day-based ordering

Test Results

All tests pass, including the enhanced test_sentinel_value_approach that now covers:

  • Querying for items with sentinel dates
  • Date range queries excluding sentinel values
  • Helper functions for checking non-sentinel dates

…oach

- Replace NaiveDate with DateTime<Utc> wrapper for better precision and ordering
- Add DateTimeWrapper struct implementing ToKey trait using timestamp_millis()
- Create SENTINEL_DATE_TIMESTAMP constant and create_sentinel_date() helper
- Update test data to use DateTime values with proper timestamps
- Demonstrate queryable date/time "null" values using sentinel pattern
- Follows the chrono DateTime example pattern from the codebase documentation

This enables efficient querying of date/time fields even when representing
"no date" values, avoiding the limitations of Option<T> fields in indexes.
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.

1 participant