Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-33536

Incorrect join results when joining twice with the same DF

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0, 3.0.1, 3.1.0
    • Fix Version/s: 3.1.0
    • Component/s: SQL
    • Labels:
      None

      Description

      val emp1 = Seq[TestData](
        TestData(1, "sales"),
        TestData(2, "personnel"),
        TestData(3, "develop"),
        TestData(4, "IT")).toDS()
      val emp2 = Seq[TestData](
        TestData(1, "sales"),
        TestData(2, "personnel"),
        TestData(3, "develop")).toDS()
      val emp3 = emp1.join(emp2, emp1("key") === emp2("key")).select(emp1("*"))
      emp1.join(emp3, emp1.col("key") === emp3.col("key"), "left_outer").select(emp1.col("*"), emp3.col("key").as("e2")).show()
      
      // wrong result
      +---+---------+---+
      |key|    value| e2|
      +---+---------+---+
      |  1|    sales|  1|
      |  2|personnel|  2|
      |  3|  develop|  3|
      |  4|       IT|  4|
      +---+---------+---+
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Ngone51 wuyi
                Reporter:
                Ngone51 wuyi
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: