Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/18697#discussion_r130286222 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/JoinSuite.scala --- @@ -36,6 +40,70 @@ class JoinSuite extends QueryTest with SharedSQLContext { df.queryExecution.optimizedPlan.stats.sizeInBytes } + test("SPARK-16683 Repeated joins to same table can leak attributes via partitioning") { + val hier = sqlContext.sparkSession.sparkContext.parallelize(Seq( + ("A10", "A1"), + ("A11", "A1"), + ("A20", "A2"), + ("A21", "A2"), + ("B10", "B1"), + ("B11", "B1"), + ("B20", "B2"), + ("B21", "B2"), + ("A1", "A"), + ("A2", "A"), + ("B1", "B"), + ("B2", "B") + )).toDF("son", "parent").cache() // passes if cache is removed but with count on dist1 + hier.createOrReplaceTempView("hier") + hier.count() // if this is removed it passes + + val base = sqlContext.sparkSession.sparkContext.parallelize(Seq( + Tuple1("A10"), + Tuple1("A11"), + Tuple1("A20"), + Tuple1("A21"), + Tuple1("B10"), + Tuple1("B11"), + Tuple1("B20"), + Tuple1("B21") + )).toDF("id") + base.createOrReplaceTempView("base") + + val dist1 = spark.sql(""" + SELECT parent level1 --- End diff -- Please fix the code indent.
--- 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