turboFei commented on a change in pull request #26485: [SPARK-29860][SQL] Fix
dataType mismatch issue for InSubquery.
URL: https://github.com/apache/spark/pull/26485#discussion_r345624398
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
##########
@@ -3304,6 +3304,22 @@ class SQLQuerySuite extends QueryTest with
SharedSparkSession {
""".stripMargin).collect()
}
}
+
+ test("SPARK-29860: Fix dataType mismatch issue for InSubquery") {
+ withTable("ta", "tb", "tc") {
+ sql("create table ta(id Decimal(18,0)) using parquet")
+ sql("create table tb(id Decimal(19,0)) using parquet")
+ sql("create table tc(id Decimal(17,2)) using parquet")
+ sql("insert into table ta values(cast(1 as Decimal(18, 0)))")
+ sql("insert into table tb values(cast(1 as Decimal(19, 0)))")
+ sql("insert into table tc values(cast(1 as Decimal(17, 2)))")
+ val df1 = sql("select id from ta where id in (select id from tb)")
+ checkAnswer(df1, Array(Row(new java.math.BigDecimal(1))))
+ val df2 = sql("select id from tb where id in (select id from ta)")
+ checkAnswer(df2, Array(Row(new java.math.BigDecimal(1))))
+ intercept[AnalysisException](sql("select id from ta where id in (select
id from tc)"))
Review comment:
done, thank!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]