etseidl opened a new issue, #15815:
URL: https://github.com/apache/datafusion/issues/15815
### Describe the bug
Performing a query where a `Float16` column is compared to an integer
literal results in the `Float16` being cast to `Int64`.
```sql
> explain format indent select * from
'parquet-testing/data/float16_nonzeros_and_nans.parquet' where x > 2;
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type | plan
|
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| logical_plan | Filter:
CAST(parquet-testing/data/float16_nonzeros_and_nans.parquet.x AS Int64) >
Int64(2)
|
| | TableScan:
parquet-testing/data/float16_nonzeros_and_nans.parquet projection=[x],
partial_filters=[CAST(parquet-testing/data/float16_nonzeros_and_nans.parquet.x
AS Int64) > Int64(2)] |
| physical_plan | CoalesceBatchesExec: target_batch_size=8192
|
| | FilterExec: CAST(x@0 AS Int64) > 2
|
| | RepartitionExec: partitioning=RoundRobinBatch(8),
input_partitions=1
|
| | DataSourceExec: file_groups={1 group:
[[Users/seidl/src/datafusion/parquet-testing/data/float16_nonzeros_and_nans.parquet]]},
projection=[x], file_type=parquet, predicate=CAST(x@0 AS Int64) > 2 |
| |
|
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
```
### To Reproduce
```
./target/debug/datafusion-cli -c "explain format indent select * from
'parquet-testing/data/float16_nonzeros_and_nans.parquet' where x > 2;"
```
### Expected behavior
This should instead cast `2` to `Float16`.
```
+---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type | plan
|
+---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| logical_plan | Filter:
parquet-testing/data/float16_nonzeros_and_nans.parquet.x > Float16(2)
|
| | TableScan:
parquet-testing/data/float16_nonzeros_and_nans.parquet projection=[x],
partial_filters=[parquet-testing/data/float16_nonzeros_and_nans.parquet.x >
Float16(2)]
|
| physical_plan | CoalesceBatchesExec: target_batch_size=8192
|
| | FilterExec: x@0 > 2
|
| | RepartitionExec: partitioning=RoundRobinBatch(8),
input_partitions=1
|
| | DataSourceExec: file_groups={1 group:
[[Users/seidl/src/datafusion/parquet-testing/data/float16_nonzeros_and_nans.parquet]]},
projection=[x], file_type=parquet, predicate=x@0 > 2,
pruning_predicate=x_null_count@1 != row_count@2 AND x_max@0 > 2,
required_guarantees=[] |
| |
|
+---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
```
### 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: [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]