tokoko commented on code in PR #12800:
URL: https://github.com/apache/datafusion/pull/12800#discussion_r1792254336


##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -990,24 +989,44 @@ pub async fn from_substrait_rel(
 fn ensure_schema_compatability(
     table: DataFrame,
     substrait_schema: DFSchema,
-) -> Result<DataFrame> {
-    let df_schema = table.schema().to_owned().strip_qualifiers();
+) -> Result<LogicalPlan> {
+    let df_schema = table.schema().to_owned();

Review Comment:
   I'm bumping into some round-trip errors when I try this. I suspect it should 
be related to optimization calls used in the tests themselves. I'll leave it as 
is for now and try to fix when I get rid of optimization calls in the tests as 
well.



##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -990,24 +989,44 @@ pub async fn from_substrait_rel(
 fn ensure_schema_compatability(
     table: DataFrame,
     substrait_schema: DFSchema,
-) -> Result<DataFrame> {
-    let df_schema = table.schema().to_owned().strip_qualifiers();
+) -> Result<LogicalPlan> {
+    let df_schema = table.schema().to_owned();
     if df_schema.logically_equivalent_names_and_types(&substrait_schema) {
-        return Ok(table);
+        return Ok(table.into_unoptimized_plan());
     }
-    let selected_columns = substrait_schema
-        .strip_qualifiers()
-        .fields()
-        .iter()
-        .map(|substrait_field| {
-            let df_field =
-                df_schema.field_with_unqualified_name(substrait_field.name())?;
-            ensure_field_compatability(df_field, substrait_field)?;
-            Ok(col(format!("\"{}\"", df_field.name())))
-        })
-        .collect::<Result<_>>()?;
 
-    table.select(selected_columns)
+    let t = table.into_unoptimized_plan();

Review Comment:
   done



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