Wenchen Fan created SPARK-61978:
-----------------------------------
Summary: Fix CHAR padding of IN lists that mix CHAR columns with
other elements
Key: SPARK-61978
URL: https://issues.apache.org/jira/browse/SPARK-61978
Project: Spark
Issue Type: Bug
Components: SQL
Affects Versions: 5.0.0
Reporter: Wenchen Fan
`value IN (e1, e2, ...)` should return what `value = e1 OR value = e2 OR ...`
returns. When the value is a CHAR column and the IN list mixes CHAR columns
with STRING/VARCHAR columns or string literals, ApplyCharTypePadding pads
nothing, so the CHAR-vs-CHAR pairs are compared unpadded. IN then misses rows
that the equality matches, and NOT IN keeps rows it should drop.
{code:sql}
CREATE TABLE t(c CHAR(2), c5 CHAR(5), s STRING, v VARCHAR(5)) USING parquet;
INSERT INTO t VALUES ('a', 'a', 'a', 'a');
SELECT c = c5, c IN (c5, s), c NOT IN (c5, s), c IN (c5, v), c IN (c5, 'x'), c
IN (s, 'a') FROM t;
-- actual: true, false, true, false, false, false
-- expected: true, true, false, true, true, true
{code}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]