Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-18173

SQL: implement EVERY and SOME aggregate functions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.15
    • sql
    • SQL Calcite: Added EVERY/SOME aggregate functions
    • Docs Required, Release Notes Required

    Description

      Aggregate functions EVERY and SOME are part of SQL standard. Unfortunately, they're not implemented in AI3 beta1 yet. Could you please implement them?

      In AI2, they work in the following manner:

      create table tmp_table_age_name_wage (key_field INT PRIMARY KEY,AGE INT,field1 VARCHAR,field2 INT);
      insert into tmp_table_age_name_wage (key_field,AGE,field1,field2) values (1, 42,'John',100000);
      insert into tmp_table_age_name_wage (key_field,AGE,field1,field2) values (2, 43,'Jack',50000);
      insert into tmp_table_age_name_wage (key_field,AGE,field1,field2) values (3, 42,'Jen',30000);
      insert into tmp_table_age_name_wage (key_field,AGE,field1,field2) values (4, 42,'Jim',70000);
      insert into tmp_table_age_name_wage (key_field,AGE,field1,field2) values (5, 41,'Jess',30000);
      insert into tmp_table_age_name_wage (key_field,AGE,field1,field2) values (6, 50,'Joe',40000);
      insert into tmp_table_age_name_wage (key_field,AGE,field1,field2) values (7, 43,'Jeff',20000);
      insert into tmp_table_age_name_wage (key_field,AGE,field1,field2) values (8, 32,'Joel',80000);
      insert into tmp_table_age_name_wage (key_field,AGE,field1,field2) values (9, 33,'Joe',30000);
      insert into tmp_table_age_name_wage (key_field,AGE,field1,field2) values (10, 41,'Jill',90000);
      SELECT EVERY(AGE > 20) FROM tmp_table_age_name_wage;            --> true
      SELECT EVERY(AGE > 40) FROM tmp_table_age_name_wage;            --> false
      SELECT SOME(field2 = 90000) FROM tmp_table_age_name_wage;       --> true
      SELECT SOME(field2 <> 90000) FROM tmp_table_age_name_wage;      --> true
      

      Attachments

        Issue Links

          Activity

            People

              alex_pl Aleksey Plekhanov
              akhitrin Andrey Khitrin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m