optimize_if_chain_to_multiif
Replace if(cond1, then1, if(cond2, …)) chains to multiIf. Currently it’s not beneficial for numeric types.optimize_if_transform_const_strings_to_lowcardinality
If enabled, theif, multiIf, and transform functions with constant string result branches (and defaults) will return LowCardinality(String) instead of String.
Disabled by default because constructing a LowCardinality dictionary per block can be slower than a plain String result when the dictionary is not reused downstream.
The optimization is not applied when the whole expression is constant (constant condition or input as well): a constant gains nothing from LowCardinality, and functions expecting constant String arguments (e.g. arrayReduce, joinGet, tupleElement) keep working.
All the result branches have to be constants, so a nested if chain such as if(cond1, 'a', if(cond2, 'b', 'c')) keeps plain String: the else-branch of the outer if is another if, not a constant. Write it as multiIf(cond1, 'a', cond2, 'b', 'c') to get LowCardinality(String).
This setting has no effect while optimize_if_transform_strings_to_enum is enabled: the Enum rewrite takes precedence, and the result stays String (or Nullable(String)) even for the explicit multiIf form above.