Skip to content

Commit 1551cb7

Browse files
committed
Convert OuterReferenceColumn to a Column sql node
1 parent 7535d93 commit 1551cb7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

datafusion/sql/src/unparser/expr.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,7 @@ impl Unparser<'_> {
417417
Expr::Placeholder(_) => {
418418
not_impl_err!("Unsupported Expr conversion: {expr:?}")
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,8 +872,8 @@ mod tests {
874872
use datafusion_expr::{
875873
case, col, exists,
876874
expr::{AggregateFunction, AggregateFunctionDefinition},
877-
lit, not, not_exists, table_scan, try_cast, when, wildcard, ColumnarValue,
878-
ScalarUDF, ScalarUDFImpl, Signature, Volatility, WindowFrame,
875+
lit, not, not_exists, out_ref_col, table_scan, try_cast, when, wildcard,
876+
ColumnarValue, ScalarUDF, ScalarUDFImpl, Signature, Volatility, WindowFrame,
879877
WindowFunctionDefinition,
880878
};
881879

@@ -1160,6 +1158,10 @@ mod tests {
11601158
try_cast(col("a"), DataType::UInt32),
11611159
r#"TRY_CAST("a" AS INTEGER UNSIGNED)"#,
11621160
),
1161+
(
1162+
out_ref_col(DataType::Int32, "t.a").gt(lit(1)),
1163+
r#"("t"."a" > 1)"#,
1164+
),
11631165
];
11641166

11651167
for (expr, expected) in tests {

0 commit comments

Comments
 (0)