Commit 82181ac
authored
fix: update schema's data type for
## Which issue does this PR close?
- Closes apache#18102.
## Rationale for this change
This prepare statements below (no type declaration) fails to execute.
```sql
DataFusion CLI v51.0.0
> PREPARE my_plan AS SELECT a, b FROM (VALUES ($1, $2)) AS t(a, b);
0 row(s) fetched.
Elapsed 0.005 seconds.
> EXECUTE my_plan(1, 2);
Arrow error: Invalid argument error: column types must match schema types, expected Null but found Int64 at column index 0
>
```
To make it works, schema's data type should be updated after replacing
parameters.
But calling `recompute_schema` alone does not suffice because we skip
recomputing schema for `LogicalPlan::Values`:
https://github.com/apache/datafusion/blob/97af468f3da63582f4bacef7d0d1fba4313aa7c4/datafusion/expr/src/logical_plan/plan.rs#L635-L638
## What changes are included in this PR?
- Update schema for `LogicalPlan::Values` manually.
## Are these changes tested?
Yes.
## Are there any user-facing changes?
No.LogicalPlan::Values after placeholder substitution (apache#18740)1 parent e64de0f commit 82181ac
File tree
2 files changed
+31
-3
lines changed- datafusion
- expr/src/logical_plan
- sqllogictest/test_files
2 files changed
+31
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1476 | 1476 | | |
1477 | 1477 | | |
1478 | 1478 | | |
1479 | | - | |
1480 | | - | |
1481 | | - | |
| 1479 | + | |
1482 | 1480 | | |
1483 | 1481 | | |
1484 | 1482 | | |
1485 | 1483 | | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
1486 | 1502 | | |
1487 | 1503 | | |
1488 | 1504 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
0 commit comments