Skip to content
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
27 changes: 2 additions & 25 deletions datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,35 +711,12 @@ impl<'a> ConstEvaluator<'a> {
} else {
// Non-ListArray
match ScalarValue::try_from_array(&a, 0) {
Ok(s) => {
// TODO: support the optimization for `Map` type after support impl hash for it
if matches!(&s, ScalarValue::Map(_)) {
ConstSimplifyResult::SimplifyRuntimeError(
DataFusionError::NotImplemented("Const evaluate for Map type is still not supported".to_string()),
expr,
)
} else {
ConstSimplifyResult::Simplified(s, metadata)
}
}
Ok(s) => ConstSimplifyResult::Simplified(s, metadata),
Err(err) => ConstSimplifyResult::SimplifyRuntimeError(err, expr),
}
}
}
ColumnarValue::Scalar(s) => {
// TODO: support the optimization for `Map` type after support impl hash for it
if matches!(&s, ScalarValue::Map(_)) {
ConstSimplifyResult::SimplifyRuntimeError(
DataFusionError::NotImplemented(
"Const evaluate for Map type is still not supported"
.to_string(),
),
expr,
)
} else {
ConstSimplifyResult::Simplified(s, metadata)
}
}
ColumnarValue::Scalar(s) => ConstSimplifyResult::Simplified(s, metadata),
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions datafusion/sqllogictest/test_files/simplify_expr.slt
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,14 @@ query B
SELECT a / NULL::DECIMAL(4,3) > 1.2::decimal(2,1) FROM VALUES (1) AS t(a);
----
NULL

query TT
explain SELECT CASE WHEN 1 > 0 THEN MAP {'x': 100} ELSE MAP {'y': 200} END AS a;
----
logical_plan
01)Projection: Map([{"x":"100"}]) AS a
02)--EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[[{x:100}] as a]
02)--PlaceholderRowExec