-
Notifications
You must be signed in to change notification settings - Fork 159
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
[FEAT] dec128 math #3143
[FEAT] dec128 math #3143
Conversation
samster25
commented
Oct 29, 2024
•
edited
Loading
edited
- Removes Int128 Type
- Refactor Decimal128 to be backed by a DataArray rather than a LogicalArray
- Implements math operations for Decimal
- Implements comparison operations for Decimal
CodSpeed Performance ReportMerging #3143 will not alter performanceComparing Summary
|
impl Add for &Decimal128Array { | ||
type Output = DaftResult<Decimal128Array>; | ||
fn add(self, rhs: Self) -> Self::Output { | ||
assert_eq!(self.data_type(), rhs.data_type()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we instead return an error instead of panicking if the types dont match?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should hopefully never happen since the series code should correctly match cast the types before this gets called.
let l = unsafe { values.get_unchecked(a) }; | ||
let r = unsafe { values.get_unchecked(b) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some SAFETY
comments explaining why this won't go out of bounds.
let l = unsafe { values.get_unchecked(a) }; | ||
let r = unsafe { values.get_unchecked(b) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
a7c5af7
to
618daa5
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3143 +/- ##
==========================================
- Coverage 78.80% 77.48% -1.33%
==========================================
Files 621 621
Lines 74809 76670 +1861
==========================================
+ Hits 58954 59405 +451
- Misses 15855 17265 +1410
|
@samster25 It looks like df = (
daft.from_pydict({"floats": [328.00, 300.00, 299.00]})
.select(col("floats").cast(daft.DataType.decimal128(5, 2)))
.where(col('floats').between(300, 400))
.collect()
) |
so i think this is actually an issue with the decimal casting. Here's a tiny PR to fix the panic. |
* Removes Int128 Type * Refactor Decimal128 to be backed by a DataArray rather than a LogicalArray * Implements math operations for Decimal * Implements comparison operations for Decimal