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

pyspark.sql.functions.array_repeat should support Column as count argument

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.0, 3.0.0
    • Fix Version/s: 3.0.0
    • Component/s: PySpark, SQL
    • Labels:
      None

      Description

      In Scala, Spark supports (https://github.com/apache/spark/blob/c3e32bf06c35ba2580d46150923abfa795b4446a/sql/core/src/main/scala/org/apache/spark/sql/functions.scala#L3777)

       

      (Column, Column) => Column
      

      variant of array_repeat, however PySpark doesn't

      >>> import pyspark                                               
      >>> from pyspark.sql import functions as f
      >>> pyspark.__version__
      '3.0.0.dev0'
       
      >>> f.array_repeat(f.col("foo"), f.col("bar"))
      ...
      TypeError: Column is not iterable
      
      
      

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                zero323 Maciej Szymkiewicz
                Reporter:
                zero323 Maciej Szymkiewicz
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: