Skip to content
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

Extra decimal support for TPC-H Q18 #261

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion optd-core/src/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Postgres has a set of rules to determine decimal in this case but let's ignore it for now...

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}"
),
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}"),
}
}
Expand Down
Loading