-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge?
Now, types of expressions in WHERE/HAVING/ORDER BY/ON closure would not be checked at logical planning but checked in type_coercion while generating physical plan.
For instance:
#[tokio::test]
async fn test_unary_negation_on_string_error() -> Result<()> {
let test_sqls = vec![
// "SELECT (1 + 'a') FROM (SELECT 1);",
"SELECT * FROM (SELECT 1) WHERE (1 + 'a');",
// "SELECT count(*) FROM (SELECT 1) GROUP BY (1 + 'a');",
"SELECT column1 FROM (VALUES (1)) AS t(column1) GROUP BY column1 HAVING (1 + 'a');",
"SELECT * FROM (SELECT 1) ORDER BY (1 + 'a');",
"SELECT * FROM (SELECT 1) AS t1 JOIN (SELECT 1) AS t2 ON (1 + 'a');",
];
let mut cnt = 0;
for sql in test_sqls {
let ctx = SessionContext::new();
if ctx.sql(sql).await.is_err() {
cnt += 1;
}
}
assert_eq!(4, cnt);
Ok(())
}The test above will fail.
I think we should report error as early as possible, the statements above should reject invalid expressions in logical planning phase just as SELECT (1 + 'a') FROM (SELECT 1);
Describe the solution you'd like
I plan to follow the error-handling pattern used for SELECT 1 + 'a'; by invoking Expr::to_field. I would welcome any alternative approaches or suggestions on the implementation details.
Describe alternatives you've considered
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request