goldmedal commented on issue #15351:
URL: https://github.com/apache/datafusion/issues/15351#issuecomment-2746211723

   > [@goldmedal](https://github.com/goldmedal) it works fine for all other 
types except map, it fails here during plan creation: 
https://github.com/delta-io/delta-rs/blob/30dd5edf9717f6545ffbc73e65b676b8adaa0a01/crates/core/src/operations/merge/mod.rs#L1359
   
   Thanks for the information, @ion-elgreco. Now, I can reproduce the same 
error message in the DataFusion side by the following code:
   ```rust
   #[tokio::main]
   async fn main() -> Result<()> {
       let sql = r#"
           CREATE TABLE t1
           AS VALUES ( 1, Map {'key1': 1.0, 'key2': 2.0 }, Map {'key3': 3.0, 
'key4': 4.0});
       "#;
   
       let ctx = SessionContext::new();
   
       let mut builder = SchemaBuilder::new();
       builder.push(Field::new("key", DataType::Utf8, false));
       builder.push(Field::new("value", DataType::Float64, false));
       let fields = builder.finish().fields;
   
       let fields = Field::new("key_value", DataType::Struct(fields), false);
       let map_type = DataType::Map(Arc::new(fields), false);
       let case_when = case(col("column1"))
           .when(lit(1), col("column2"))
           .when(lit(2), cast(col("column3"), map_type))
           .end()?;
       ctx.sql(sql).await?.show().await?;
       ctx.table("t1")
           .await?
           .select(vec![case_when])?
           .show()
           .await?;
   
       Ok(())
   }
   ```
   I'll take a look at this.


-- 
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-unsubscr...@datafusion.apache.org

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


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

Reply via email to