-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
DateTime
aggregation response when 0 rows (#30)
In Clickhouse `min(datetime_field)` strangely returns `1st Jan 1970 00:00:000` when there are 0 rows to aggregate. That's why we also do that, when Elastic returns `null`s. I've already played with Clickhouse a bit and I'm pretty sure just replacing `min/max/etc` calls to Clickhouse with `minOrNull/maxOrNull/...` will solve the issue. I checked also numeric fields, and Elastic also returns `null`s when there are 0 rows. So I think `...OrNull` is just what we need. Elastic response for 0 rows: <img width="1728" alt="Screenshot 2024-05-03 at 09 50 29" src="https://github.com/QuesmaOrg/quesma/assets/5407146/a73d5bac-f899-4281-aa9b-214086f7f30d"> Ours: <img width="1660" alt="Screenshot 2024-05-03 at 09 50 13" src="https://github.com/QuesmaOrg/quesma/assets/5407146/1d3c7751-dcc0-4b7c-a9a8-7bf535f18aa0"> Before: <img width="1728" alt="Screenshot 2024-05-07 at 20 40 59" src="https://github.com/QuesmaOrg/quesma/assets/5407146/e03367a6-7db9-4ddf-9067-a29309eca406"> After: `null` + nothing on the chart <img width="1725" alt="Screenshot 2024-05-07 at 21 07 20" src="https://github.com/QuesmaOrg/quesma/assets/5407146/80fcec52-e641-478a-b3a9-4a9a1a087a15"> <img width="1385" alt="Screenshot 2024-05-07 at 21 07 14" src="https://github.com/QuesmaOrg/quesma/assets/5407146/97170df6-16c4-4a90-84d8-30e8f234b896"> Also some other `max` still works: <img width="1667" alt="Screenshot 2024-05-07 at 21 20 42" src="https://github.com/QuesmaOrg/quesma/assets/5407146/632e3dee-4c8a-463a-b953-9c7040138edb">
- Loading branch information
Showing
7 changed files
with
50 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters