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_r346101593
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
 ##########
 @@ -3304,6 +3304,26 @@ class SQLQuerySuite extends QueryTest with 
SharedSparkSession {
         """.stripMargin).collect()
     }
   }
+
+  test("SPARK-29860: Fix dataType mismatch issue for InSubquery") {
+    withTempView("ta", "tb", "tc", "td") {
+      sql("create temporary view ta as select * from values(cast(1 as 
Decimal(8, 0))) as ta(id)")
+      sql("create temporary view tb as select * from values(cast(1 as 
Decimal(9, 0))) as tb(id)")
+      sql("create temporary view tc as select * from values(cast(1 as 
Decimal(7, 2))), " +
+        "cast(1.23 as Decimal(7,2)) as tc(id)")
+      sql("create temporary view td as select * from values(cast(1 as 
Decimal(38, 31))) as td(id)")
+      val df1 = sql("select id from ta where id in (select id from tb)")
+      checkAnswer(df1, Array(Row(new java.math.BigDecimal(1))))
 
 Review comment:
   > I think the PR description above should be self-descriptive, so could you 
please make that more clearer? What's a root cause of this issue, how to fix, 
brabrabra...
   
   Thanks, updated.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to