This is an automated email from the ASF dual-hosted git repository.

alamb 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 842f3933e3 Convert OuterReferenceColumn to a Column sql node (#10544)
842f3933e3 is described below

commit 842f3933e3496a022984c2a37254475a3bcde1bf
Author: Jax Liu <[email protected]>
AuthorDate: Thu May 16 21:23:33 2024 +0800

    Convert OuterReferenceColumn to a Column sql node (#10544)
---
 datafusion/sql/src/unparser/expr.rs | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/datafusion/sql/src/unparser/expr.rs 
b/datafusion/sql/src/unparser/expr.rs
index c871d1f21f..416ab03d1f 100644
--- a/datafusion/sql/src/unparser/expr.rs
+++ b/datafusion/sql/src/unparser/expr.rs
@@ -417,9 +417,7 @@ impl Unparser<'_> {
             Expr::Placeholder(p) => {
                 Ok(ast::Expr::Value(ast::Value::Placeholder(p.id.to_string())))
             }
-            Expr::OuterReferenceColumn(_, _) => {
-                not_impl_err!("Unsupported Expr conversion: {expr:?}")
-            }
+            Expr::OuterReferenceColumn(_, col) => self.col_to_sql(col),
             Expr::Unnest(_) => not_impl_err!("Unsupported Expr conversion: 
{expr:?}"),
         }
     }
@@ -874,9 +872,9 @@ mod tests {
     use datafusion_expr::{
         case, col, exists,
         expr::{AggregateFunction, AggregateFunctionDefinition},
-        lit, not, not_exists, placeholder, table_scan, try_cast, when, 
wildcard,
-        ColumnarValue, ScalarUDF, ScalarUDFImpl, Signature, Volatility, 
WindowFrame,
-        WindowFunctionDefinition,
+        lit, not, not_exists, out_ref_col, placeholder, table_scan, try_cast, 
when,
+        wildcard, ColumnarValue, ScalarUDF, ScalarUDFImpl, Signature, 
Volatility,
+        WindowFrame, WindowFunctionDefinition,
     };
 
     use crate::unparser::dialect::CustomDialect;
@@ -1161,6 +1159,10 @@ mod tests {
                 r#"TRY_CAST("a" AS INTEGER UNSIGNED)"#,
             ),
             (col("x").eq(placeholder("$1")), r#"("x" = $1)"#),
+            (
+                out_ref_col(DataType::Int32, "t.a").gt(lit(1)),
+                r#"("t"."a" > 1)"#,
+            ),
         ];
 
         for (expr, expected) in tests {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to