Skip to content

Instantly share code, notes, and snippets.

@avalanchy
Created February 7, 2022 10:45
Show Gist options
  • Save avalanchy/83ac38ce4b55b0591b5f705d175f50a1 to your computer and use it in GitHub Desktop.
Save avalanchy/83ac38ce4b55b0591b5f705d175f50a1 to your computer and use it in GitHub Desktop.
Apache Druid differences in aggregation results when uising default value for null is disabled (druid.generic.useDefaultValueForNull = False)
aggregator type op before op after res before res after same res
longSum, doubleSum regular 0 + 0 0 + null 0 0 TRUE
longSum, doubleSum regular 0 + 0 null + null 0 null FALSE
longLast, doubleLast and longLastTimestamp regular Pick 0 Pick null 0 null FALSE
longMax regular [0, -1] [0, -1] 0 0 TRUE
longMax regular [0, -1] [null, -1] 0 -1 FALSE
doubleMean regular [0, 1] [0, 1] 0,5 0,5 TRUE
doubleMean regular [0, 1] [null, 1] 0,5 0,5 TRUE
doubleMean (with filter-out nulls) regular [0, 1] [null, 1] 0,5 1 FALSE
count regular [-1, 0, 1, 0] [-1, 0, 1, null] 4 4 TRUE
arithmetic (+) post 0 + 0 0 + 0 0 0 TRUE
arithmetic (+) post 0 + 0 0 + null 0 null FALSE
arithmetic (+) post 0 + 0 null + null 0 null FALSE
arithmetic (-) post 0 - 0 0 - 0 0 0 TRUE
arithmetic (-) post 0 - 0 0 – null 0 null FALSE
arithmetic (-) post 0 - 0 null – 0 0 null FALSE
arithmetic (-) post 0 - 0 null – null 0 null FALSE
arithmetic (*) post 0 * 0 0 * 0 0 null FALSE
arithmetic (*) post 0 * 0 0 * null 0 null FALSE
arithmetic (*) post 0 * 0 null * null 0 null FALSE
arithmetic (/) post 0 / 0 0 / null 0 null FALSE
arithmetic (/) post 0 / 0 null / 0 0 null FALSE
arithmetic (/) post 0 / 1 null / 1 0 null FALSE
arithmetic (/) post 0 / 0 null / null 0 null FALSE
longGreatest post [0, 0] [0, null] 0 0 TRUE
longGreatest post [0, 0] [null, null] 0 null FALSE
longGreatest post [0, -1] [null, -1] 0 -1 FALSE
fieldAccess post 0 null 0 null FALSE
finalizingFieldAccess post pair with 0 pair with null 0 null FALSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment