Stamatis Zampetakis created HIVE-28925: ------------------------------------------
Summary: Redundant CAST around COALESCE in aggregate query with SUM0 Key: HIVE-28925 URL: https://issues.apache.org/jira/browse/HIVE-28925 Project: Hive Issue Type: Improvement Components: CBO Reporter: Stamatis Zampetakis Assignee: Stamatis Zampetakis After the Calcite upgrade to 1.33.0 (HIVE-27102) a redundant CAST appears on aggregate queries with SUM0. {code:sql} CREATE TABLE test (c_numeric STRING); EXPLAIN CBO SELECT `$SUM0`(c_numeric) FROM test; {code} {noformat} HiveProject(_o__c0=[CAST(COALESCE($0, 0E0:DOUBLE)):DOUBLE]) HiveAggregate(group=[{}], agg#0=[sum($0)]) HiveTableScan(table=[[default, test]], table:alias=[test]) {noformat} The CAST to DOUBLE is redundant since the result of COALESCE is always a DOUBLE. -- This message was sent by Atlassian Jira (v8.20.10#820010)