Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-3773

Implement FIRST_VALUES aggregate function

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.11.0
    • Labels:

      Description

      Similar to FIRST_VALUE, but would allow the user to specify how many values to keep. This could use a MinMaxPriorityQueue under the covers and be much more efficient than using multiple NTH_VALUE calls to do the same like this:

      SELECT entity_id,
             NTH_VALUE(user_id,1) WITHIN GROUP (ORDER BY last_read_date DESC) as nth1_user_id,
             NTH_VALUE(user_id,2) WITHIN GROUP (ORDER BY last_read_date DESC) as nth2_user_id,
             NTH_VALUE(user_id,3) WITHIN GROUP (ORDER BY last_read_date DESC) as nth3_user_id,
             count(*)
      FROM  MY_TABLE 
      WHERE tenant_id='00Dx0000000XXXX'
      AND entity_id in ('0D5x000000ABCD','0D5x000000ABCE')
      GROUP BY entity_id;
      

        Attachments

        1. PHOENIX-3773.patch
          51 kB
          Loknath Priyatham Teja Singamsetty
        2. PHOENIX-3773.v2.patch
          51 kB
          Loknath Priyatham Teja Singamsetty
        3. PHOENIX-3773.v3.patch
          50 kB
          Loknath Priyatham Teja Singamsetty
        4. PHOENIX-3773_master.patch
          51 kB
          Loknath Priyatham Teja Singamsetty
        5. PHOENIX-3773_4.x-HBase-0.98.patch
          58 kB
          Loknath Priyatham Teja Singamsetty
        6. PHOENIX-3773_4.x-HBase-0.98_v2.patch
          94 kB
          James Taylor
        7. PHOENIX-3773_master_v2.patch
          88 kB
          Loknath Priyatham Teja Singamsetty
        8. PHOENIX-3773_4.x-HBase-1.1_v2.patch
          88 kB
          Loknath Priyatham Teja Singamsetty
        9. PHOENIX-3773_4.x-HBase-1.2_v2.patch
          88 kB
          Loknath Priyatham Teja Singamsetty

          Issue Links

            Activity

              People

              • Assignee:
                singamteja Loknath Priyatham Teja Singamsetty
                Reporter:
                jamestaylor James Taylor
              • Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: