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

Don't treat Null as UTF8(None) and change error info. #2801

Merged
merged 2 commits into from
Jun 27, 2022
Merged
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
20 changes: 8 additions & 12 deletions datafusion/physical-expr/src/expressions/in_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ macro_rules! make_contains {
ColumnarValue::Scalar(s) => match s {
ScalarValue::$SCALAR_VALUE(Some(v)) => Some(*v),
ScalarValue::$SCALAR_VALUE(None) => None,
ScalarValue::Utf8(None) => None,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#2764 merged, we don't need to treat Null as UTF8(None).

datatype => unimplemented!("Unexpected type {} for InList", datatype),
datatype => unreachable!("InList can't reach other data type {} for {}.", datatype, s),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the expr and list_expr has the same data type, the code can't reach this point

},
ColumnarValue::Array(_) => {
unimplemented!("InList does not yet support nested columns.")
Expand Down Expand Up @@ -163,9 +162,7 @@ macro_rules! make_contains_primitive {
ColumnarValue::Scalar(s) => match s {
ScalarValue::$SCALAR_VALUE(Some(v)) => Some(*v),
ScalarValue::$SCALAR_VALUE(None) => None,
// TODO this is bug, for primitive the expr list should be cast to the same data type
ScalarValue::Utf8(None) => None,
datatype => unimplemented!("Unexpected type {} for InList", datatype),
datatype => unreachable!("InList can't reach other data type {} for {}.", datatype, s),
},
ColumnarValue::Array(_) => {
unimplemented!("InList does not yet support nested columns.")
Expand Down Expand Up @@ -317,11 +314,10 @@ fn make_list_contains_decimal(
.flat_map(|v| match v {
ColumnarValue::Scalar(s) => match s {
Decimal128(v128op, _, _) => *v128op,
_ => {
unreachable!(
"InList can't reach other data type for decimal data type."
)
}
datatype => unreachable!(
"InList can't reach other data type {} for {}.",
datatype, s
),
},
ColumnarValue::Array(_) => {
unimplemented!("InList does not yet support nested columns.")
Expand Down Expand Up @@ -360,8 +356,8 @@ fn make_set_contains_decimal(
.iter()
.flat_map(|v| match v {
Decimal128(v128op, _, _) => *v128op,
_ => {
unreachable!("InList can't reach other data type for decimal data type.")
datatype => {
unreachable!("InList can't reach other data type {} for {}.", datatype, v)
}
})
.collect::<Vec<_>>();
Expand Down