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

Support plus + operator as concatenation for StringType columns in pyspark

    XMLWordPrintableJSON

    Details

    • Type: Wish
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Won't Fix
    • Affects Version/s: 2.4.3
    • Fix Version/s: None
    • Component/s: PySpark
    • Labels:
      None

      Description

      Right now if one try to use plus operator for two columns in pyspark like `F.col('a') + F.col('b')`, pyspark always try to treat it as arithmetic addition like `2+3=5`. If the columns are `StringType`, pyspark try to convert them to number then do the addition. However, in python and pandas world, the plus operation for string type means concatenation not arithmetic addition. So it will be great that pyspark also support the same logic that `F.col('str1') + F.col('str2') + F.col('str3')` yields `F.concat(F.col('str1'), F.col('str2'), F.col('str3'))`.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              louis925 Louis Yang
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: