Error when creating Kudu Analytical View - NonRecoverableException: Got out of order key column

When creating Analytical Views with Kudu, make sure to specify the Primary Key as the first field in the Analytical View definition:

Good:

CREATE ANALYTICAL VIEW `mydatabase`.`mytable_av_1` 
PRIMARY KEY (col_prim_key, p_ymd) 
PARTITION BY HASH(col_prim_key, p_ymd) PARTITIONS 10 
SEQUENCE COLUMN case_key
STORED AS KUDU AS 
(SELECT col_prim_key,
       region,
       p_ymd
FROM `mydatabase`.`mytable`
GROUP BY col_prim_key,
         p_ymd,
         region);

Bad:

CREATE ANALYTICAL VIEW `mydatabase`.`mytable_av_1` 
PRIMARY KEY (col_prim_key, p_ymd) 
PARTITION BY HASH(col_prim_key, p_ymd) PARTITIONS 10 
SEQUENCE COLUMN case_key
STORED AS KUDU AS 
(SELECT region,
       col_prim_key,
       p_ymd
FROM `mydatabase`.`mytable`
GROUP BY col_prim_key,
         p_ymd,
         region);
1 Like