From 7bbdf0076eac8e2165c8f82bbad0adb59ab78a37 Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Sat, 20 Apr 2024 10:04:17 -0600 Subject: [PATCH] fix test regression --- core/src/execution/datafusion/expressions/cast.rs | 6 ++++-- core/src/execution/datafusion/planner.rs | 2 +- .../main/scala/org/apache/comet/serde/QueryPlanSerde.scala | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/execution/datafusion/expressions/cast.rs b/core/src/execution/datafusion/expressions/cast.rs index a74467956..10079855d 100644 --- a/core/src/execution/datafusion/expressions/cast.rs +++ b/core/src/execution/datafusion/expressions/cast.rs @@ -146,8 +146,8 @@ impl Display for Cast { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!( f, - "Cast [data_type: {}, timezone: {}, child: {}]", - self.data_type, self.timezone, self.child + "Cast [data_type: {}, timezone: {}, child: {}, eval_mode: {:?}]", + self.data_type, self.timezone, self.child, &self.eval_mode ) } } @@ -160,6 +160,7 @@ impl PartialEq for Cast { self.child.eq(&x.child) && self.timezone.eq(&x.timezone) && self.data_type.eq(&x.data_type) + && self.eval_mode.eq(&x.eval_mode) }) .unwrap_or(false) } @@ -217,6 +218,7 @@ impl PhysicalExpr for Cast { self.child.hash(&mut s); self.data_type.hash(&mut s); self.timezone.hash(&mut s); + self.eval_mode.hash(&mut s); self.hash(&mut s); } } diff --git a/core/src/execution/datafusion/planner.rs b/core/src/execution/datafusion/planner.rs index c3d931396..089f0e092 100644 --- a/core/src/execution/datafusion/planner.rs +++ b/core/src/execution/datafusion/planner.rs @@ -349,7 +349,7 @@ impl PhysicalPlanner { "LEGACY" => EvalMode::Legacy, other => { return Err(ExecutionError::GeneralError(format!( - "Invalid Cast EvalMode: {other}" + "Invalid Cast EvalMode: \"{other}\"" ))) } }; diff --git a/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala b/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala index cae1d6b37..2e4379251 100644 --- a/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala +++ b/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala @@ -1000,6 +1000,7 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde { .newBuilder() .setChild(e) .setDatatype(serializeDataType(IntegerType).get) + .setEvalMode("LEGACY") // year is not affected by ANSI mode .build()) .build() })