-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
In current inList implemention, we don't consider the data type of the list value.
For example:
I create a 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 |
+---------------+--------------+------------+-------------+-----------------+-------------+
with data
❯ select * from food;
+---------+-------------------+-------+
| a | b | c |
+---------+-------------------+-------+
| 0.00001 | 0.000000000001000 | true |
| 0.00002 | 0.000000000002000 | false |
| 0.00002 | 0.000000000002000 | false |
| 0.00003 | 0.000000000003000 | true |
| 0.00003 | 0.000000000003000 | true |
| 0.00003 | 0.000000000003000 | true |
| 0.00004 | 0.000000000004000 | false |
| 0.00004 | 0.000000000004000 | false |
| 0.00004 | 0.000000000004000 | false |
| 0.00004 | 0.000000000004000 | false |
| 0.00005 | 0.000000000005000 | true |
| 0.00005 | 0.000000000005000 | true |
| 0.00005 | 0.000000000005000 | true |
| 0.00005 | 0.000000000005000 | true |
| 0.00005 | 0.000000000005000 | true |
+---------+-------------------+-------+
using the in filter to select data
❯ select * from food where c in (true,123);
+---------+-------------------+------+
| a | b | c |
+---------+-------------------+------+
| 0.00001 | 0.000000000001000 | true |
| 0.00003 | 0.000000000003000 | true |
| 0.00003 | 0.000000000003000 | true |
| 0.00003 | 0.000000000003000 | true |
| 0.00005 | 0.000000000005000 | true |
| 0.00005 | 0.000000000005000 | true |
| 0.00005 | 0.000000000005000 | true |
| 0.00005 | 0.000000000005000 | true |
| 0.00005 | 0.000000000005000 | true |
+---------+-------------------+------+
The column of c is bool data type, we can apply the compare operations to diff data type.
The behavior of other database, such as spark
spark-sql> desc t3;
c1 int
we will get the error message
spark-sql> select * from t3 where c1 in(1,23,false);
Error in query: cannot resolve '(spark_catalog.default.t3.c1 IN (1, 23, false))' due to data type mismatch: Arguments must be same type but were: int != boolean; line 1 pos 26;
'Project [*]
+- 'Filter c1#358 IN (1,23,false)
+- SubqueryAlias spark_catalog.default.t3
+- HiveTableRelation [`default`.`t3`, org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Data Cols: [c1#358], Partition Cols: []]
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working