alamb commented on code in PR #20306:
URL: https://github.com/apache/datafusion/pull/20306#discussion_r2805547847
##########
datafusion/optimizer/src/analyzer/type_coercion.rs:
##########
@@ -2742,4 +2771,69 @@ mod test {
"
)
}
+
+ fn zero_arg_scalar_func() -> Expr {
+ let fun = ScalarUDF::new_from_impl(TestScalarUDF {
+ signature: Signature::uniform(1, vec![DataType::Float32],
Volatility::Stable),
+ });
+ Expr::ScalarFunction(ScalarFunction::new_udf(Arc::new(fun), vec![]))
+ }
+
+ #[test]
Review Comment:
I agree with @neilconway here -- I do think the tests are redundant and I
think we can just use the slt tests
##########
datafusion/sqllogictest/test_files/type_coercion.slt:
##########
@@ -281,3 +281,30 @@ SELECT true FROM t0 WHERE (REGEXP_MATCH(t0.v1, t0.v1)) NOT
ILIKE [];
statement ok
DROP TABLE t0;
+
+###############################################################################
+## Test that IS NULL / IS NOT NULL / SIMILAR TO / CAST / TRY_CAST validate ##
+## their inner expressions. ##
+###############################################################################
+
+# https://github.com/apache/datafusion/issues/20201
+
+# IS NULL should reject invalid inner expression
Review Comment:
I ran these tests without the code changes to verify they cover the issue
and they fail like
```
Completed 403 test files in 8 seconds
failure in type_coercion.slt for sql SELECT * FROM (SELECT 1)
WHERE (STARTS_WITH() IS NULL);
caused by
External error: task 22188 panicked with message "index out of bounds: the
len is 0 but the index is 1"
Error: Execution("1 failures")
error: test failed, to rerun pass `-p datafusion-sqllogictest --test
sqllogictests`
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]