From b4b1aea68dd77767737b5298394b6e929c17ac28 Mon Sep 17 00:00:00 2001 From: Benjamin Owad Date: Tue, 17 Dec 2024 23:59:51 -0500 Subject: [PATCH] Extra decimal support for TPC-H Q18 (#261) Regrettably the query is still too slow... Would like a sanity check on this in any case. Won't merge until unnest-exists is merged --- optd-core/src/nodes.rs | 11 ++++++++++- .../src/plan_nodes/predicates/constant_pred.rs | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/optd-core/src/nodes.rs b/optd-core/src/nodes.rs index f15d98e1..da30ba32 100644 --- a/optd-core/src/nodes.rs +++ b/optd-core/src/nodes.rs @@ -211,7 +211,16 @@ impl Value { } _ => panic!("{self} could not be converted into an Date32"), }), - _ => unimplemented!("Have not implemented convert_to_type for DataType {typ}"), + DataType::Decimal128(_, _) => Value::Decimal128(match self { + // TODO: Should we be ignoring the scale and precision here? + Value::Int128(i128) => *i128, + Value::Int64(i64) => (*i64).into(), + Value::Int32(i32) => (*i32).into(), + _ => panic!("{self} could not be converted into an Decimal128"), + }), + _ => unimplemented!( + "Have not implemented convert_to_type from {self} for DataType {typ}" + ), } } } diff --git a/optd-datafusion-repr/src/plan_nodes/predicates/constant_pred.rs b/optd-datafusion-repr/src/plan_nodes/predicates/constant_pred.rs index c95c10e5..b8990620 100644 --- a/optd-datafusion-repr/src/plan_nodes/predicates/constant_pred.rs +++ b/optd-datafusion-repr/src/plan_nodes/predicates/constant_pred.rs @@ -46,6 +46,7 @@ impl ConstantType { Value::Int64(_) => ConstantType::Int64, Value::Float(_) => ConstantType::Float64, Value::Date32(_) => ConstantType::Date, + Value::Decimal128(_) => ConstantType::Decimal, _ => unimplemented!("get_data_type_from_value() not implemented for value {value}"), } }