Blizzara commented on code in PR #12245:
URL: https://github.com/apache/datafusion/pull/12245#discussion_r1745712603


##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -657,7 +662,13 @@ pub async fn from_substrait_rel(
                         table: nt.names[2].clone().into(),
                     },
                 };
-                let t = ctx.table(table_reference).await?;
+
+                let substrait_schema =
+                    from_substrait_named_struct(named_struct, extensions)?
+                        .replace_qualifier(table_reference.clone());
+
+                let t = ctx.table(table_reference.clone()).await?;
+                let t = ensure_schema_compatability(t, substrait_schema)?;
                 let t = t.into_optimized_plan()?;
                 extract_projection(t, &read.projection)

Review Comment:
   I started wondering if the `ensure_schema_compatability` can now conflict 
with `extract_projection` - and I think it can, either by failing if DF doesn't 
optimize the select into a projection, or if DF does, then by overriding the 
select's projection with the Substrait projection...
   
   I guess a fix would be something like in `extract_projection`, if there is 
an existing `scan.projection`, then apply `columnIndices` on it first 



-- 
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