Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support data type coerced and decimal in INLIST expr #2755

Closed
7 tasks done
liukun4515 opened this issue Jun 21, 2022 · 2 comments
Closed
7 tasks done

support data type coerced and decimal in INLIST expr #2755

liukun4515 opened this issue Jun 21, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@liukun4515
Copy link
Contributor

liukun4515 commented Jun 21, 2022

related issue:

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
(This section helps Arrow developers understand the context and why for this feature, in addition to the what)

When I apply the in list filter to the below table

❯ \d food
+---------------+--------------+------------+-------------+-----------------+-------------+
| table_catalog | table_schema | table_name | column_name | data_type       | is_nullable |
+---------------+--------------+------------+-------------+-----------------+-------------+
| datafusion    | public       | food       | a           | Decimal(10, 5)  | NO          |
| datafusion    | public       | food       | b           | Decimal(20, 15) | NO          |
| datafusion    | public       | food       | c           | Boolean         | NO          |
+---------------+--------------+------------+-------------+-----------------+-------------+

❯  select * from food where a in (1);
ArrowError(ExternalError(NotImplemented("InList does not support datatype Decimal(10, 5).")))

explain the query:

❯ explain select * from food where a in (1);
+---------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type     | plan                                                                                                                                                                         |
+---------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| logical_plan  | Projection: #food.a, #food.b, #food.c                                                                                                                                        |
|               |   Filter: #food.a IN ([Int64(1)])                                                                                                                                            |
|               |     TableScan: food projection=Some([a, b, c]), partial_filters=[#food.a IN ([Int64(1)])]                                                                                    |
| physical_plan | ProjectionExec: expr=[a@0 as a, b@1 as b, c@2 as c]                                                                                                                          |
|               |   CoalesceBatchesExec: target_batch_size=4096                                                                                                                                |
|               |     FilterExec: a@0 IN ([CastExpr { expr: Literal { value: Int64(1) }, cast_type: Decimal(10, 5), cast_options: CastOptions { safe: false } }])                              |
|               |       RepartitionExec: partitioning=RoundRobinBatch(16)                                                                                                                      |
|               |         CsvExec: files=[/Users/kliu3/Documents/github/arrow-datafusion/datafusion-cli/target/debug/aggregate_simple.csv], has_header=false, limit=None, projection=[a, b, c] |
|               |                                                                                                                                                                              |
+---------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set. Query took 0.007 seconds.

We need convert the data type of expr and list to the common data type.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@liukun4515 liukun4515 added the enhancement New feature or request label Jun 21, 2022
@liukun4515
Copy link
Contributor Author

I will file a PR to fix it.

@liukun4515
Copy link
Contributor Author

blocked by this issue #2759

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant