You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "cht42 (via GitHub)" <gi...@apache.org> on 2025/05/04 10:53:44 UTC

Re: [PR] Substrait: Handle inner map fields in schema renaming [datafusion]

cht42 commented on code in PR #15869:
URL: https://github.com/apache/datafusion/pull/15869#discussion_r2072584358


##########
datafusion/substrait/tests/cases/substrait_validations.rs:
##########
@@ -61,16 +61,41 @@ mod tests {
             let proto_plan =
                 read_json("tests/testdata/test_plans/simple_select.substrait.json");
             // this is the exact schema of the Substrait plan
-            let df_schema =
-                vec![("a", DataType::Int32, false), ("b", DataType::Int32, true)];
+            let df_schema = vec![
+                ("a", DataType::Int32, false),
+                ("b", DataType::Int32, true),
+                (
+                    "c",
+                    DataType::Map(
+                        Arc::new(Field::new_struct(
+                            "entries",
+                            Fields::from(vec![
+                                Field::new("key", DataType::Utf8, false),
+                                Field::new_struct(
+                                    "value",
+                                    Fields::from(vec![Field::new(
+                                        "d",
+                                        DataType::Utf8,
+                                        true,
+                                    )]),
+                                    true,
+                                ),
+                            ]),
+                            true,
+                        )),
+                        false,
+                    ),
+                    true,
+                ),
+            ];
 
             let ctx = generate_context_with_table("DATA", df_schema)?;
             let plan = from_substrait_plan(&ctx.state(), &proto_plan).await?;
 
             assert_snapshot!(
             plan,
             @r#"
-                Projection: DATA.a, DATA.b
+                Projection: DATA.a, DATA.b, DATA.c
                   TableScan: DATA

Review Comment:
   updated with unit tests



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org