gruuya commented on PR #13468:
URL: https://github.com/apache/datafusion/pull/13468#issuecomment-2483560145

   Thanks for looking into this!
   
   FWIW, I've also been trying to see what the problem is, and the following is 
a minimal repro (test case) along the lines of the delta-rs test I've been able 
to come up with
   ```rust
       #[tokio::test]
       async fn test_list_item() -> Result<()> {
           use datafusion_functions_nested::expr_fn::make_array;
   
           let element_field = Arc::new(Field::new("element", DataType::Int32, 
true));
           let items_field = Field::new(
               "items",
               DataType::List(element_field.clone()),
               true,
           );
           let schema = Schema::new(vec![items_field.clone()]);
   
           let mut items_builder =
               
ListBuilder::new(Int32Builder::new()).with_field(element_field.clone());
           items_builder.append_value([Some(1)]);
           let batch = RecordBatch::try_new(Arc::new(schema), 
vec![Arc::new(items_builder.finish())])?;
   
           let ctx = SessionContext::new();
           let df = ctx.read_batch(batch).expect("source DataFrame")
               .with_column("condition", lit(false))?
               .select(vec![case(col("condition")).when(lit(false), 
make_array(vec![lit(2), lit(3)])).otherwise(col("items"))?.alias("items")])?;
   
   
           let _ = df.create_physical_plan().await?;
   
           Ok(())
       }
   ```
   
   This might be a red herring, but I'm also looking at whether the issue 
arises somewhere in `TypeCoercion` analyzer, specifically in 
`coerce_case_expression`. This is because the `CASE` clause here is crucial for 
the repro, as without it the outermost plan doesn't get coerced to the child 
plan's list type (i.e. the one with items named `element`), but instead retains 
the types of the expression itself (with the generic `item` names).


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