Hi Developers, I am looking for some guidance on this situation described here: https://github.com/apache/druid/issues/10644. I am trying to understand if the behavior is expected and the documentation for the runtime parameter druid.generic.useDefaultValueForNull is not updated to reflect the behavior OR this is an actual bug in the engine.
As described in the issue, there are a couple of scenarios that don’t seem right according to the documentation: Example when results are Long.MIN_VALUE 1) perform a MAX aggregation function 2) on empty rows 3) druid.generic.useDefaultValueForNull=true Query: SELECT MAX(l1) FILTER(WHERE dim1 = 'non_existing') FROM druid.foo Result: -9223372036854775808 Reference to explicitly set value in source code: https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/query/aggregation/LongMaxAggregatorFactory.java#L56-L60 Example when results are 0 1) perform a SUM aggregation function 2) on empty rows 3) druid.generic.useDefaultValueForNull=true Query: SELECT SUM(l1) FILTER(WHERE dim1 = 'non_existing') FROM druid.foo Result: 0 Reference to explicitly set value in source code: https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/query/aggregation/LongSumAggregatorFactory.java#L56-L60 >From the Druid documentations link <https://druid.apache.org/docs/latest/configuration/index.html#sql-compatible-null-handling> : Property Description Default druid.generic.useDefaultValueForNull When set to true, null values will be stored as '' for string columns and 0 for numeric columns. Set to false to store and query data in SQL compatible mode. true The documentation does not explicitly mention what the expected results of an aggregation query would be but I expected the results from both of the above queries to be 0; not Long.MIN_VALUE in some instances. Should the documentation be updated or should the code be fixed? I can put in either fix, but want to know which the community thinks is appropriate. Best, Eric