Details

    • Type: Task
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Fix Version/s: 10.2
    • Component/s: None
    • Labels:
      None

      Description

      There is a class of window functions that can be computed on the fly, after ordering. These functions are:

      • rank
      • dense_rank
      • row_number

      These functions can be computed directly. In order to do this we must:

      1. Sort the rows.
      2. Detect partition boundaries (on the fly as well)
      3. Given partition boundaries, compute the corresponding function value, for each row.

      A second set of functions:

      • percent_rank
      • ntile
        Can be computed given two passes. The extra information that we require is the number of rows in the partition. In order to find the number of rows, we must first detect partition boundaries and then we can compute the number of rows per partition.

      Key pieces for implementing this:

      • Make use of the filesort interface, since we do not need temporary tables for these functions.
      • It is a very similar use case to the GROUP BY statement. An important task is figuring out partition boundaries. The classes used for computing GROUP BY, might prove useful.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Show
              cvicentiu Vicentiu Ciorbaru added a comment - - edited Sergei Petrunia Igor Babaev Oleksandr Byelkin

                People

                • Assignee:
                  cvicentiu Vicentiu Ciorbaru
                  Reporter:
                  cvicentiu Vicentiu Ciorbaru
                • Votes:
                  3 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated: