Skip to content

fix:Add support for TimeDelta type in Python and Rust #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Keerthi421
Copy link

PR Description:
Issue #344
This PR implements support for the TimeDelta type in CocoIndex as requested in issue #344.

Changes:
-->Added TimeDelta = Annotated[datetime.timedelta, TypeKind('TimeDelta')] in Python typing module
-->Added TimeDelta variant to Rust's type system
-->Implemented conversion between Python's datetime.timedelta and Rust's chrono::Duration
-->Added PostgreSQL storage support using the native interval type

Testing:
-->Tests should be added to verify:
-->Python type analysis correctly identifies datetime.timedelta objects
-->Conversion between Python and Rust time delta representations works correctly
-->PostgreSQL storage and retrieval works as expected
This addresses #344.

Copy link
Member

@badmonster0 badmonster0 left a comment

Choose a reason for hiding this comment

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

Thanks for making this PR!

This PR fails to build:

https://github.com/cocoindex-io/cocoindex/actions/runs/14589192202/job/40959965493?pr=368

You can follow this guide to build and test it locally:

https://cocoindex.io/docs/about/contributing

@badmonster0
Copy link
Member

@Keerthi421 friendly follow up to see if you are still actively working on this? thanks!

@badmonster0
Copy link
Member

close since this has been up for 2 weeks, and seems no longer active :) thanks a lot for taking a look!

@badmonster0 badmonster0 closed this May 6, 2025
lemorage added a commit to lemorage/cocoindex that referenced this pull request May 16, 2025
badmonster0 pushed a commit that referenced this pull request May 20, 2025
* feat: add support for TimeDelta type in Python and Rust

Continuation on #368

* refactor: update duration parser to align with ISO 8601 standard

- Replaced naive parsing with structured component-based approach
- Enhanced both iso8601 and human-readable parsers with proper validation and unit order checks
- Added more tests, achieving 97.52% test coverage

* feat: make duration parser lenient by allowing duplicate and out of order units

* refactor: inline code with some cleanups
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