mkleen commented on code in PR #19930:
URL: https://github.com/apache/datafusion/pull/19930#discussion_r2777724487


##########
datafusion/sql/src/expr/identifier.rs:
##########
@@ -172,36 +173,44 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
                         not_impl_err!("compound identifier: {ids:?}")
                     } else {
                         // Check the outer_query_schema and try to find a match
-                        if let Some(outer) = 
planner_context.outer_query_schema() {
-                            let search_result = search_dfschema(&ids, outer);
-                            match search_result {
-                                // Found matching field with spare 
identifier(s) for nested field(s) in structure
-                                Some((field, qualifier, nested_names))
-                                    if !nested_names.is_empty() =>
-                                {
-                                    // TODO: remove when can support nested 
identifiers for OuterReferenceColumn
-                                    not_impl_err!(
-                                        "Nested identifiers are not yet 
supported for OuterReferenceColumn {}",
-                                        Column::from((qualifier, field))
-                                            .quoted_flat_name()
-                                    )
-                                }
-                                // Found matching field with no spare 
identifier(s)
-                                Some((field, qualifier, _nested_names)) => {
-                                    // Found an exact match on a qualified 
name in the outer plan schema, so this is an outer reference column
-                                    Ok(Expr::OuterReferenceColumn(
-                                        Arc::clone(field),
-                                        Column::from((qualifier, field)),
-                                    ))
-                                }
-                                // Found no matching field, will return a 
default
-                                None => {
-                                    let s = &ids[0..ids.len()];
-                                    // safe unwrap as s can never be empty or 
exceed the bounds
-                                    let (relation, column_name) =
-                                        form_identifier(s).unwrap();
-                                    Ok(Expr::Column(Column::new(relation, 
column_name)))
-                                }
+                        let outer_schemas = 
planner_context.outer_queries_schemas();
+                        let mut maybe_result = None;
+                        if !outer_schemas.is_empty() {

Review Comment:
   This is gone and cleaned it up a little bit more.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to