You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Takeshi Yamamuro (Jira)" <ji...@apache.org> on 2021/03/24 23:34:00 UTC

[jira] [Resolved] (SPARK-34833) Apply right-padding correctly for correlated subqueries

     [ https://issues.apache.org/jira/browse/SPARK-34833?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Takeshi Yamamuro resolved SPARK-34833.
--------------------------------------
    Fix Version/s: 3.1.2
                   3.2.0
         Assignee: Takeshi Yamamuro
       Resolution: Fixed

Resolved by https://github.com/apache/spark/pull/31940

> Apply right-padding correctly for correlated subqueries
> -------------------------------------------------------
>
>                 Key: SPARK-34833
>                 URL: https://issues.apache.org/jira/browse/SPARK-34833
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.1.0, 3.2.0, 3.1.1
>            Reporter: Takeshi Yamamuro
>            Assignee: Takeshi Yamamuro
>            Priority: Blocker
>              Labels: correctness
>             Fix For: 3.2.0, 3.1.2
>
>
> This ticket aim at  fixing the bug that does not apply right-padding for char types inside correlated subquries.
> For example,  a query below returns nothing in master, but a correct result is `c`.
> {code}
> scala> sql(s"CREATE TABLE t1(v VARCHAR(3), c CHAR(5)) USING parquet")
> scala> sql(s"CREATE TABLE t2(v VARCHAR(5), c CHAR(7)) USING parquet")
> scala> sql("INSERT INTO t1 VALUES ('c', 'b')")
> scala> sql("INSERT INTO t2 VALUES ('a', 'b')")
> scala> val df = sql("""
>   |SELECT v FROM t1
>   |WHERE 'a' IN (SELECT v FROM t2 WHERE t2.c = t1.c )""".stripMargin)
> scala> df.show()
> +---+
> |  v|
> +---+
> +---+
> {code}
> This is because `ApplyCharTypePadding`  does not handle the case above to apply right-padding into `'abc'`. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org