Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18455#discussion_r125567839
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala 
---
    @@ -2616,4 +2616,27 @@ class SQLQuerySuite extends QueryTest with 
SharedSQLContext {
         val e = intercept[AnalysisException](sql("SELECT nvl(1, 2, 3)"))
         assert(e.message.contains("Invalid number of arguments"))
       }
    +
    +  test("SPARK-21228: InSet incorrect handling of structs") {
    +    withTempView("A") {
    +      // reduce this from the default of 10 so the repro query text is not 
too long
    +      withSQLConf((SQLConf.OPTIMIZER_INSET_CONVERSION_THRESHOLD.key -> 
"3")) {
    +        // a relation that has 1 column of struct type with values (1,1), 
..., (9, 9)
    +        spark.range(1, 10).selectExpr("named_struct('a', id, 'b', id) as 
a")
    +          .createOrReplaceTempView("A")
    +        val df = sql(
    +          """
    +            |SELECT * from
    +            | (SELECT MIN(a) as minA FROM A) AA -- this Aggregate will 
return UnsafeRows
    +            | -- the IN will become InSet with a Set of GenericInternalRows
    +            | -- a GenericInternalRow is never equal to an UnsafeRow so 
the query would
    +            | -- returns 0 results, which is incorrect
    +            | WHERE minA IN (NAMED_STRUCT('a', 1L, 'b', 1L), 
NAMED_STRUCT('a', 2L, 'b', 2L),
    +            |   NAMED_STRUCT('a', 3L, 'b', 3L))
    +          """.stripMargin)
    +        df.explain
    --- End diff --
    
    Do we need explain here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to