Skip to content

Commit

Permalink
fix signature
Browse files Browse the repository at this point in the history
Signed-off-by: Jay Zhan <[email protected]>
  • Loading branch information
jayzhan211 committed Dec 8, 2024
1 parent 1e43c90 commit afe48d1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
18 changes: 1 addition & 17 deletions datafusion/expr-common/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl TypeSignature {
}
}

#[derive(Debug, Clone, Eq, PartialOrd)]
#[derive(Debug, Clone, Eq, PartialEq, PartialOrd, Hash)]
pub enum TypeSignatureClass {
Timestamp,
Date,
Expand All @@ -169,22 +169,6 @@ pub enum TypeSignatureClass {
Native(LogicalTypeRef),
}

// TODO: MSRV issue: Default macro doesn't work in 1.79. Use default PartialEq macro after it is able to compile
impl PartialEq for TypeSignatureClass {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Native(l0), Self::Native(r0)) => l0 == r0,
_ => core::mem::discriminant(self) == core::mem::discriminant(other),
}
}
}

impl std::hash::Hash for TypeSignatureClass {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
core::mem::discriminant(self).hash(state);
}
}

impl Display for TypeSignatureClass {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "TypeSignatureClass::{self:?}")
Expand Down
7 changes: 1 addition & 6 deletions datafusion/sqllogictest/test_files/expr.slt
Original file line number Diff line number Diff line change
Expand Up @@ -1109,15 +1109,10 @@ SELECT date_part('second', timestamp '2020-09-08T12:00:12.12345678+00:00')
----
12

query I
SELECT date_part('millisecond', timestamp '2020-09-08T12:00:12.12345678+00:00')
----
12

query I
SELECT date_part('microsecond', timestamp '2020-09-08T12:00:12.12345678+00:00')
----
12123
12123456

query error DataFusion error: Internal error: unit Nanosecond not supported
SELECT date_part('nanosecond', timestamp '2020-09-08T12:00:12.12345678+00:00')
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/group_by.slt
Original file line number Diff line number Diff line change
Expand Up @@ -4281,7 +4281,7 @@ EXPLAIN SELECT extract(month from ts) as months
logical_plan
01)Sort: months DESC NULLS FIRST, fetch=5
02)--Projection: date_part(Utf8("MONTH"),csv_with_timestamps.ts) AS months
03)----Aggregate: groupBy=[[date_part(Utf8View("MONTH"), csv_with_timestamps.ts) AS date_part(Utf8("MONTH"),csv_with_timestamps.ts)]], aggr=[[]]
03)----Aggregate: groupBy=[[date_part(Utf8("MONTH"), csv_with_timestamps.ts)]], aggr=[[]]
04)------TableScan: csv_with_timestamps projection=[ts]
physical_plan
01)SortPreservingMergeExec: [months@0 DESC], fetch=5
Expand Down

0 comments on commit afe48d1

Please sign in to comment.