You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Nicholas Chammas (JIRA)" <ji...@apache.org> on 2016/12/10 22:45:58 UTC

[jira] [Created] (SPARK-18818) Window...orderBy() should accept an 'ascending' parameter just like DataFrame.orderBy()

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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org