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

    https://github.com/apache/spark/pull/21941#discussion_r206763501
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala
 ---
    @@ -676,4 +677,42 @@ class PlanParserSuite extends AnalysisTest {
           OneRowRelation().select('rtrim.function("c&^,.", "bc...,,,&&&ccc"))
         )
       }
    +
    +  test("precedence of set operations") {
    +    val a = table("a").select(star())
    +    val b = table("b").select(star())
    +    val c = table("c").select(star())
    +    val d = table("d").select(star())
    +
    +    val query1 =
    +      """
    +        |SELECT * FROM a
    +        |UNION
    +        |SELECT * FROM b
    +        |EXCEPT
    +        |SELECT * FROM c
    +        |INTERSECT
    +        |SELECT * FROM d
    +      """.stripMargin
    +
    +    val query2 =
    +      """
    +        |SELECT * FROM a
    +        |UNION
    +        |SELECT * FROM b
    +        |EXCEPT ALL
    +        |SELECT * FROM c
    +        |INTERSECT ALL
    +        |SELECT * FROM d
    +      """.stripMargin
    +
    +    assertEqual(query1, Distinct(a.union(b)).except(c.intersect(d)))
    --- End diff --
    
    also add `withSQLConf(SQLConf.SETOPS_PRECEDENCE_ENFORCED.key -> "true") {`


---

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

Reply via email to