jayzhan211 opened a new issue, #11312:
URL: https://github.com/apache/datafusion/issues/11312

   ### Is your feature request related to a problem or challenge?
   
   Failed test
   ```
   statement ok
   create table t(name varchar, val int) as values ('a', 1), ('b', 2), ('c', 3);
   
   query error DataFusion error: Execution error: named_struct even arguments 
must be string literals, got t\.name instead at position 0
   select named_struct(name, val) from t;
   ```
   
   key could be ColumnarValue::Array (multiple rows), so we could not restrict 
it to ColumnarValue::Scalar only
   
   ```rust
   let (names, values): (Vec<_>, Vec<_>) = args
           .chunks_exact(2)
           .enumerate()
           .map(|(i, chunk)| {
   
               let name_column = &chunk[0];
   
               let name = match name_column {
                   ColumnarValue::Scalar(ScalarValue::Utf8(Some(name_scalar))) 
=> name_scalar,
                   _ => return exec_err!("named_struct even arguments must be 
string literals, got {name_column:?} instead at position {}", i * 2)
               };
   
               Ok((name, chunk[1].clone()))
           })
           .collect::<Result<Vec<_>>>()?
           .into_iter()
           .unzip();
   ```
   
   ### Describe the solution you'd like
   
   _No response_
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


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