Skip to content

Commit 842f393

Browse files
authored
Convert OuterReferenceColumn to a Column sql node (#10544)
1 parent 410b04f commit 842f393

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

datafusion/sql/src/unparser/expr.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,7 @@ impl Unparser<'_> {
417417
Expr::Placeholder(p) => {
418418
Ok(ast::Expr::Value(ast::Value::Placeholder(p.id.to_string())))
419419
}
420-
Expr::OuterReferenceColumn(_, _) => {
421-
not_impl_err!("Unsupported Expr conversion: {expr:?}")
422-
}
420+
Expr::OuterReferenceColumn(_, col) => self.col_to_sql(col),
423421
Expr::Unnest(_) => not_impl_err!("Unsupported Expr conversion: {expr:?}"),
424422
}
425423
}
@@ -874,9 +872,9 @@ mod tests {
874872
use datafusion_expr::{
875873
case, col, exists,
876874
expr::{AggregateFunction, AggregateFunctionDefinition},
877-
lit, not, not_exists, placeholder, table_scan, try_cast, when, wildcard,
878-
ColumnarValue, ScalarUDF, ScalarUDFImpl, Signature, Volatility, WindowFrame,
879-
WindowFunctionDefinition,
875+
lit, not, not_exists, out_ref_col, placeholder, table_scan, try_cast, when,
876+
wildcard, ColumnarValue, ScalarUDF, ScalarUDFImpl, Signature, Volatility,
877+
WindowFrame, WindowFunctionDefinition,
880878
};
881879

882880
use crate::unparser::dialect::CustomDialect;
@@ -1161,6 +1159,10 @@ mod tests {
11611159
r#"TRY_CAST("a" AS INTEGER UNSIGNED)"#,
11621160
),
11631161
(col("x").eq(placeholder("$1")), r#"("x" = $1)"#),
1162+
(
1163+
out_ref_col(DataType::Int32, "t.a").gt(lit(1)),
1164+
r#"("t"."a" > 1)"#,
1165+
),
11641166
];
11651167

11661168
for (expr, expected) in tests {

0 commit comments

Comments
 (0)