Skip to content

Commit

Permalink
Convert OuterReferenceColumn to a Column sql node (#10544)
Browse files Browse the repository at this point in the history
  • Loading branch information
goldmedal authored May 16, 2024
1 parent 410b04f commit 842f393
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions datafusion/sql/src/unparser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}"),
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 842f393

Please sign in to comment.