Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/16762#discussion_r99474050 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/JoinSuite.scala --- @@ -215,18 +215,61 @@ class JoinSuite extends QueryTest with SharedSQLContext { Row(1, null, 2, 2) :: Row(2, 2, 1, null) :: Row(2, 2, 2, 2) :: Nil) + + checkAnswer( + testData3.as("x").join(testData3.as("y"), $"x.a" > $"y.a"), + Row(2, 2, 1, null) :: Nil) + } + withSQLConf(SQLConf.CROSS_JOINS_ENABLED.key -> "false") { + val msg = "Detected cartesian product for INNER join between logical plans" + var e = intercept[AnalysisException](testData3.join(testData3).collect()) + assert(e.getMessage.contains(msg)) + e = intercept[AnalysisException] { + testData3.as("x").join(testData3.as("y"), $"x.a" > $"y.a").collect() + } + assert(e.getMessage.contains(msg)) + } + } + + test("subquery converted to cartesian product join") { --- End diff -- This is another typical example for cartesian product, which is converted from subquery.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org