Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
--DDL
CREATE TABLE T (
    pk STRING PRIMARY KEY NOT ENFOCED,
    sum_field1 BIGINT,
    max_field1 BIGINT,
    default_field BIGINT ) 
WITH ( 
'merge-engine' = 'aggregation',
'fields.sum_field1.function'='sum', \-\- sum up all sum_field1 with same pk;
'fields.max_field1.function'='max' \-\- get max value of all max_field1 with same pk   
);

-- DML
INSERT INTO T VALUES ('pk1', 1, 1, 12);
INSERT INTO T VALUES ('pk1', 1, 1, NULL);
-- verify
SELECT * FROM T;
=> output 'pk1', 2, 2, NULL

Tips: Columns which do not have each column should be designated aggregate functions using newest value to overwrite old value.


Supported aggregate functions

...