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

Implement Dataset.version and Dataset.time

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.4.1
    • Connect
    • None

    Description

      Implement Dataset.version and Dataset.time

      /**
       * The version of Spark on which this application is running.
       *
       * @since 2.0.0
       */
      def version: String = SPARK_VERSION
      
      /**
       * Executes some code block and prints to stdout the time taken to execute the block. This is
       * available in Scala only and is used primarily for interactive testing and debugging.
       *
       * @since 2.1.0
       */
      def time[T](f: => T): T = {
        val start = System.nanoTime()
        val ret = f
        val end = System.nanoTime()
        // scalastyle:off println
        println(s"Time taken: ${NANOSECONDS.toMillis(end - start)} ms")
        // scalastyle:on println
        ret
      } 

      Attachments

        Activity

          People

            panbingkun Pan Bingkun
            hvanhovell Herman van Hövell
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: