dqkqd commented on PR #18286:
URL: https://github.com/apache/datafusion/pull/18286#issuecomment-3452905101

   Thanks @Jefffrey 
   
   I tried to add test for the subquery alias: `SELECT a, b FROM (VALUES ($1, 
$2)) AS t(a, b);` similar to the issue:
   ```rust
   let df = ctx.sql("SELECT a, b FROM (VALUES ($1, $2)) AS t(a, b)").await?;
   let df_with_params_replaced = df.with_param_values(vec![
       ScalarValue::UInt32(Some(1)),
       ScalarValue::Utf8(Some("foofy".to_string())),
   ])?;
   dbg!(df_with_params_replaced.collect().await?[0].schema());
   #> Error: ArrowError(InvalidArgumentError("column types must match schema 
types, expected Null but found UInt32 at column index 0"), Some(""))
   ```
   
   But the test still fail, the plan after replacing params (the schema for `t` 
is `[Null, Null]`)
   
   ```
           Projection: t.a, t.b [a:Null;N, b:Null;N]
             SubqueryAlias: t [a:Null;N, b:Null;N]
               Projection: column1 AS a, column2 AS b [a:Null;N, b:Null;N]
                 Values: (Int32(1) AS $1, Utf8("s") AS $2) [column1:Null;N, 
column2:Null;N]
   ```
   
   The expected params:
   ```
           Projection: t.a, t.b [a:Int32;N, b:Utf8;N]
             SubqueryAlias: t [a:Int32;N, b:Utf8;N]
               Projection: column1 AS a, column2 AS b [a:Int32;N, b:Utf8;N]
                 Values: (Int32(1) AS $1, Utf8("s") AS $2) [column1:Int32;N, 
column2:Utf8;N]
   ```
   
   I think it needs more works, convert to draft for now.


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