fix: update stats serialization logic for scale-0 decimals#3916
fix: update stats serialization logic for scale-0 decimals#3916rtyler merged 1 commit intodelta-io:mainfrom
Conversation
|
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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3916 +/- ##
=======================================
Coverage 73.88% 73.89%
=======================================
Files 152 152
Lines 39426 39443 +17
Branches 39426 39443 +17
=======================================
+ Hits 29131 29147 +16
- Misses 8971 8973 +2
+ Partials 1324 1323 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: DrakeLin <drakelin18@gmail.com>
c045d52 to
9814ab2
Compare
|
@DrakeLin is this independent of any kernel changes, or is this pending something in kernel to be released? |
|
@rtyler This is independent of any kernel changes. The bug seen in delta-io/delta-kernel-rs#1431 didn't turn out to be a kernel issue (delta-rs doesn't use kernel for writes), so putting up a quick fix in delta-rs. The bug, as the original author pointed out, is due to an issue in serde_json. This bug caused delta-rs to write stats with scale 0 out as 1234.0. The kernel issue we saw was due to kernel trying to read this and failing. I think there is a kernel fix we can push out as well to relax our constraints on read, but that's independent of this change. |
Description
Creating Delta tables with Decimal(precision, scale=0) columns fails since in stats code, we store decimals as f64. serde_json converts f64 values like 1234.0 to 1234.0 for scale=0. Arrow Parser then rejects it since it expects 1234.
Modified StatsScalar enum to preserve scale information:
Tested by building delta-rs and running the example script linked in the issue.
Related Issue(s)
delta-io/delta-kernel-rs#1431
Documentation