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

spark.python.pyspark.sql.functions Typo at date_format Function

    XMLWordPrintableJSON

Details

    Description

      In the spark.python.pyspark.sql.functions module, at the date_format method's doctest, there is a typo in the year format.

      Instead of 'MM/dd/yyy', it should be 'MM/dd/yyyy' as the expected output[Row(date='04/08/2015')] indicates the following format "MM/dd/yyyy".

       

      From the official documentation:

      df = spark.createDataFrame([('2015-04-08',)], ['dt'])
      df.select(date_format('dt', 'MM/dd/yyy').alias('date')).collect()
      [Row(date='04/08/2015')]
      

       

      As a solution, I proposed the PR https://github.com/apache/spark/pull/43442.

      Attachments

        1. image-2023-10-19-19-46-22-918.png
          367 kB
          Mete Can Akar

        Issue Links

          Activity

            People

              metecanakar Mete Can Akar
              metecanakar Mete Can Akar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: