Nicholas Chammas created SPARK-18818:
----------------------------------------

             Summary: Window...orderBy() should accept an 'ascending' parameter 
just like DataFrame.orderBy()
                 Key: SPARK-18818
                 URL: https://issues.apache.org/jira/browse/SPARK-18818
             Project: Spark
          Issue Type: Improvement
          Components: PySpark, SQL
            Reporter: Nicholas Chammas
            Priority: Minor


It seems inconsistent that {{Window...orderBy()}} does not accept an 
{{ascending}} parameter, when {{DataFrame.orderBy()}} does.

It's also slightly inconvenient since to specify a descending sort order you 
have to build a column object, whereas with the {{ascending}} parameter you 
don't.

For example:

{code}
from pyspark.sql.functions import row_number

df.select(
    row_number()
    .over(
        Window
        .partitionBy(...)
        .orderBy('timestamp', ascending=False)))
{code}

vs.

{code}
from pyspark.sql.functions import row_number, col

df.select(
    row_number()
    .over(
        Window
        .partitionBy(...)
        .orderBy(col('timestamp').desc())))
{code}

It would be better if {{Window...orderBy()}} supported an {{ascending}} 
parameter just like {{DataFrame.orderBy()}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to