delta-io / delta-rs

A native Rust library for Delta Lake, with bindings into Python
https://delta-io.github.io/delta-rs/
Apache License 2.0
2.34k stars 414 forks source link

fix: expression with dates to string conversation #3019

Closed JonasDev1 closed 1 day ago

JonasDev1 commented 1 day ago

Description

In the expr to str conversation was an issue for dates.

Before this expr lit(ScalarValue::Date32(Some(18262))) was converted to _date = 2020-01-01. If you want to parse this string again as an expr it will result into ...BinaryExpr(**BinaryExpr { left: BinaryExpr(BinaryExpr { left: Literal(Int64(2020)), op: Minus, right: Literal(Int64(1)) })... which is not correct.

Now lit(ScalarValue::Date32(Some(18262))) will be converted to _date = '2020-01-01'::date, which will be parsed a as date again.

Related Issue(s)

github-actions[bot] commented 1 day ago

ACTION NEEDED

delta-rs follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

ion-elgreco commented 1 day ago

supersedes this: https://github.com/delta-io/delta-rs/pull/2463

Thanks for finishing this!

@JonasDev1 can you update the python tests asserts, then we are good to go

codecov[bot] commented 1 day ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 72.47%. Comparing base (0c4344f) to head (6653332). Report is 3 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3019 +/- ## ========================================== + Coverage 72.44% 72.47% +0.03% ========================================== Files 128 128 Lines 40841 40853 +12 Branches 40841 40853 +12 ========================================== + Hits 29587 29610 +23 + Misses 9363 9359 -4 + Partials 1891 1884 -7 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features: