-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix DistinctCount for timestamps with time zone #10043
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,12 +109,14 @@ impl AggregateExpr for DistinctCount { | |
UInt16 => Box::new(PrimitiveDistinctCountAccumulator::<UInt16Type>::new()), | ||
UInt32 => Box::new(PrimitiveDistinctCountAccumulator::<UInt32Type>::new()), | ||
UInt64 => Box::new(PrimitiveDistinctCountAccumulator::<UInt64Type>::new()), | ||
Decimal128(_, _) => { | ||
Box::new(PrimitiveDistinctCountAccumulator::<Decimal128Type>::new()) | ||
} | ||
Decimal256(_, _) => { | ||
Box::new(PrimitiveDistinctCountAccumulator::<Decimal256Type>::new()) | ||
} | ||
dt @ Decimal128(_, _) => Box::new( | ||
PrimitiveDistinctCountAccumulator::<Decimal128Type>::new() | ||
.with_data_type(dt.clone()), | ||
), | ||
dt @ Decimal256(_, _) => Box::new( | ||
PrimitiveDistinctCountAccumulator::<Decimal256Type>::new() | ||
.with_data_type(dt.clone()), | ||
), | ||
|
||
Date32 => Box::new(PrimitiveDistinctCountAccumulator::<Date32Type>::new()), | ||
Date64 => Box::new(PrimitiveDistinctCountAccumulator::<Date64Type>::new()), | ||
|
@@ -130,18 +132,22 @@ impl AggregateExpr for DistinctCount { | |
Time64(Nanosecond) => { | ||
Box::new(PrimitiveDistinctCountAccumulator::<Time64NanosecondType>::new()) | ||
} | ||
Timestamp(Microsecond, _) => Box::new(PrimitiveDistinctCountAccumulator::< | ||
TimestampMicrosecondType, | ||
>::new()), | ||
Timestamp(Millisecond, _) => Box::new(PrimitiveDistinctCountAccumulator::< | ||
TimestampMillisecondType, | ||
>::new()), | ||
Timestamp(Nanosecond, _) => Box::new(PrimitiveDistinctCountAccumulator::< | ||
TimestampNanosecondType, | ||
>::new()), | ||
Timestamp(Second, _) => { | ||
Box::new(PrimitiveDistinctCountAccumulator::<TimestampSecondType>::new()) | ||
} | ||
dt @ Timestamp(Microsecond, _) => Box::new( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should defensively always set I tried to come up with other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering the same. Let me know what you prefer? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about we do it as a follow on PR? I would like to merge this one asap as it fixes a regression |
||
PrimitiveDistinctCountAccumulator::<TimestampMicrosecondType>::new() | ||
.with_data_type(dt.clone()), | ||
), | ||
dt @ Timestamp(Millisecond, _) => Box::new( | ||
PrimitiveDistinctCountAccumulator::<TimestampMillisecondType>::new() | ||
.with_data_type(dt.clone()), | ||
), | ||
dt @ Timestamp(Nanosecond, _) => Box::new( | ||
PrimitiveDistinctCountAccumulator::<TimestampNanosecondType>::new() | ||
.with_data_type(dt.clone()), | ||
), | ||
dt @ Timestamp(Second, _) => Box::new( | ||
PrimitiveDistinctCountAccumulator::<TimestampSecondType>::new() | ||
.with_data_type(dt.clone()), | ||
), | ||
|
||
Float16 => Box::new(FloatDistinctCountAccumulator::<Float16Type>::new()), | ||
Float32 => Box::new(FloatDistinctCountAccumulator::<Float32Type>::new()), | ||
|
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 the test for decimal too?
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.
Sure, added 👍
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.
I expect the test that shows the change is needed. If this change is removed, it failed.
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.
It is clear for me the change for timestamp with timezone, but I'm not sure about the decimal one.
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.
I can show that for Decimal128 (not sure why it doesn't trigger for Decimal256). But it's better to be consistent, losing the data type might lead to unexpected consequences.