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

Incorrect examples for date_trunc function in spark 2.3.0

    XMLWordPrintableJSON

Details

    • Documentation
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 2.3.0
    • 2.3.1, 2.4.0
    • Documentation
    • None

    Description

      Within Spark documentation for spark 2.3.0, Listed examples are incorrect.

      date_trunc(fmt, ts) - Returns timestamp ts truncated to the unit specified by the format model fmt. fmt should be one of ["YEAR", "YYYY", "YY", "MON", "MONTH", "MM", "DAY", "DD", "HOUR", "MINUTE", "SECOND", "WEEK", "QUARTER"]

      Examples:

      {{> SELECT date_trunc('2015-03-05T09:32:05.359', 'YEAR'); 2015-01-01T00:00:00 > SELECT date_trunc('2015-03-05T09:32:05.359', 'MM'); 2015-03-01T00:00:00 > SELECT date_trunc('2015-03-05T09:32:05.359', 'DD'); 2015-03-05T00:00:00 > SELECT date_trunc('2015-03-05T09:32:05.359', 'HOUR'); 2015-03-05T09:00:00 }}

       

      Examples should be date_trunc(format, value)

      {{SELECT date_trunc('YEAR','2015-03-05T09:32:05.359'); }}

       

      Attachments

        Issue Links

          Activity

            People

              yumwang Yuming Wang
              dark-shadows Prakhar Gupta
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: