Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-6116 DataFrame API improvement umbrella ticket (Spark 1.5)
  3. SPARK-7321

Add Column expression for conditional statements (if, case)

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • None
    • 1.4.0
    • SQL
    • None
    • Spark 1.5 doc/QA sprint

    Description

      A good reference implementation is http://www.jooq.org/doc/3.6/manual-single-page/#case-expressions

      As an example in Python:

      when(df.age == 1, "one").when(df.age == 2, "two").otherwise("unknown")
      

      Attachments

        Activity

          People

            smacat Chen Song
            rxin Reynold Xin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: