This is an automated email from the ASF dual-hosted git repository.
mneumann pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new ead66acc3d Implement unparse `IsNotFalse` to String (#10538)
ead66acc3d is described below
commit ead66acc3dff75a1e55f5cc3c2a9f0264b7ae5dd
Author: Jax Liu <[email protected]>
AuthorDate: Thu May 16 18:15:04 2024 +0800
Implement unparse `IsNotFalse` to String (#10538)
* support to unparse IsNotFalse
* reordering expressions in pattern matching
---
datafusion/sql/src/unparser/expr.rs | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/datafusion/sql/src/unparser/expr.rs
b/datafusion/sql/src/unparser/expr.rs
index 23e3d9ab35..cd45cf9908 100644
--- a/datafusion/sql/src/unparser/expr.rs
+++ b/datafusion/sql/src/unparser/expr.rs
@@ -356,6 +356,9 @@ impl Unparser<'_> {
asc: _,
nulls_first: _,
}) => plan_err!("Sort expression should be handled by
expr_to_unparsed"),
+ Expr::IsNull(expr) => {
+ Ok(ast::Expr::IsNull(Box::new(self.expr_to_sql(expr)?)))
+ }
Expr::IsNotNull(expr) => {
Ok(ast::Expr::IsNotNull(Box::new(self.expr_to_sql(expr)?)))
}
@@ -368,6 +371,9 @@ impl Unparser<'_> {
Expr::IsFalse(expr) => {
Ok(ast::Expr::IsFalse(Box::new(self.expr_to_sql(expr)?)))
}
+ Expr::IsNotFalse(expr) => {
+ Ok(ast::Expr::IsNotFalse(Box::new(self.expr_to_sql(expr)?)))
+ }
Expr::IsUnknown(expr) => {
Ok(ast::Expr::IsUnknown(Box::new(self.expr_to_sql(expr)?)))
}
@@ -391,10 +397,6 @@ impl Unparser<'_> {
Expr::ScalarVariable(_, _) => {
not_impl_err!("Unsupported Expr conversion: {expr:?}")
}
- Expr::IsNull(expr) => {
- Ok(ast::Expr::IsNull(Box::new(self.expr_to_sql(expr)?)))
- }
- Expr::IsNotFalse(_) => not_impl_err!("Unsupported Expr conversion:
{expr:?}"),
Expr::GetIndexedField(_) => {
not_impl_err!("Unsupported Expr conversion: {expr:?}")
}
@@ -1116,6 +1118,10 @@ mod tests {
(col("a") + col("b")).gt(lit(4)).is_false(),
r#"(("a" + "b") > 4) IS FALSE"#,
),
+ (
+ (col("a") + col("b")).gt(lit(4)).is_not_false(),
+ r#"(("a" + "b") > 4) IS NOT FALSE"#,
+ ),
(
(col("a") + col("b")).gt(lit(4)).is_unknown(),
r#"(("a" + "b") > 4) IS UNKNOWN"#,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]