insert into public.sum_if_test values (1, 1, 'foo');
insert into public.sum_if_test values (2, 1, 'foo');
insert into public.sum_if_test values (3, 3, 'bar');
insert into public.sum_if_test values (4, 5, 'bar');
Given Metbase Report Configuration
custom expression configured in Metabase when summarizing this table:
Will generate SQL:
SELECT sum(CASE WHEN `public`.`sum_if_test`.`discriminator` = 'bar' THEN `public`.`sum_if_test`.`int_value` ELSE 0.0 END) AS `sum_if_with_int`
FROM `public`.`sum_if_test`
using a float 0.0 default value instead of 0 in ELSE 0.0
Expected behaviour
Sum If expression can be applied to Int typed columns
Error log
ode: 386. DB::Exception: There is no supertype for types Float64, Int64 because some of them are integers and some are floating point, but there is no floating point type, that can exactly represent all required integers: While processing if(discriminator = 'bar', int_value, 0.). (NO_COMMON_TYPE) (version 22.8.15.1) , server ClickHouseNode [uri=https://(...)/public, options={use_server_time_zone_for_dates=true,use_no_proxy=false,product_name=metabase/1.1.2}]@92216918
Describe the bug
applying
Sum If
expression in Metabase toInt
columns will generate invalid SQLSteps to reproduce
Given Schema
Given Test Data
Given Metbase Report Configuration
custom expression configured in Metabase when summarizing this table:
Will generate SQL:
using a float
0.0
default value instead of0
inELSE 0.0
Expected behaviour
Sum If
expression can be applied toInt
typed columnsError log
Configuration
Environment
ClickHouse server