Error was reported every time I used more than one expression in the coalesce function:
FAILED: ODPS-0130071:Semanti c analysis exception - Expression not in GROUP BY key : line 8:9 ''$.table''
The SQL statement is as follows:
SELECT
md5(concat(aid, bid)) as id
,aid
, bid
, sum(amountdue) as amountdue
, coalesce(
sum(regexp_coun t(get_json_obje ct(extended_x, '$.table.tableP arties'), '{')),
decode(get_json _object(extende d_x, '$.table'), NULL, 0, 1)
) as tableparty
, decode(sum(head count),null,0,s um(headcount) ) as headcount
, 'a' as pt
FROM e_orders
where pt='20170425'
group by aid, bid
FAILED: ODPS-0130071:Semanti c analysis exception - Expression not in GROUP BY key : line 8:9 ''$.table''
The SQL statement is as follows:
SELECT
md5(concat(aid, bid)) as id
,aid
, bid
, sum(amountdue) as amountdue
, coalesce(
sum(regexp_coun t(get_json_obje ct(extended_x, '$.table.tableP arties'), '{')),
decode(get_json _object(extende d_x, '$.table'), NULL, 0, 1)
) as tableparty
, decode(sum(head count),null,0,s um(headcount) ) as headcount
, 'a' as pt
FROM e_orders
where pt='20170425'
group by aid, bid
Comment