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

Support appending new columns from other DataFrames

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • 1.6.1
    • None
    • SQL
    • None

    Description

      It is common to add column(s) from other DataFrame(s) as follows. However, current withColumn() function only supports appending a new column from the same DataFrame.

          val df1 = sc.makeRDD(1 to 5).toDF("a")
          val df2 = sc.makeRDD(10 to 15).toDF("b")
          val df = df1.withColumn("b", df2("b")) // Exception
      

      Exception in thread "main" org.apache.spark.sql.AnalysisException: resolved attribute(s) b#3 missing from a#1 in operator !Project a#1,b#3 AS b#4;

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jerrylead Lijie Xu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: