XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1.0
    • None
    • SQL
    • None

    Description

      Currently in Spark, we can't use a call to `rank()` in a order by; we need to first rename the rank column to, for instance, `r` and then, use `order by r`. For example:
      This does not work:

       SELECT depname, empno, salary, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary) ORDER BY rank() OVER w;
      

      However, this one does:

       SELECT depname, empno, salary, rank() OVER w as r FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary) ORDER BY r;
      

      By the way, I took this one from Postgres behavior: postgres accept both ways.

      Attachments

        Activity

          People

            Unassigned Unassigned
            DylanGuedes Dylan Guedes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: