datafusion
datafusion copied to clipboard
FIx VALUES tuples type casts
Which issue does this PR close?
Closes #12103
Rationale for this change
The general idea here is to provide the target schema fields to the logical plan builder so that it can avoid the need to guess on VALUES tuple column types.
What changes are included in this PR?
This updates the SQL planner to accept a list of column data types for VALUE tuple columns which are then used to inform the logical plan builder which types each column should be cast to.
Are these changes tested?
I've added a test in the sqllogictests crate showing the behavior is fixed. I suspect there will be a request for more tests, but I am uncertain on where they should be placed. I did attempt to try and add a test to the sql crate's tests, but AFAICT those are all stateless which means more specific tests should probably live in the expr crate. However, I wasn't able to find an obviously place to add tests for these changes.
Are there any user-facing changes?
Some queries that would have previously failed, will no longer fail.