Skip to content
Snippets Groups Projects
Unverified Commit de58b63d authored by Simon Belak's avatar Simon Belak Committed by GitHub
Browse files

Druid: generate correct count clause for HLL fields (#11039)

parent 5e0be487
No related branches found
No related tags found
No related merge requests found
......@@ -608,7 +608,11 @@
([output-name]
{:type :count, :name output-name})
([field output-name]
(ag:filtered (filter:not (filter:nil? field)) (ag:count output-name))))
(if (isa? (:base-type field) :type/DruidHyperUnique)
{:type :hyperUnique
:name output-name
:fieldName (->rvalue field)}
(ag:filtered (filter:not (filter:nil? field)) (ag:count output-name)))))
(defn- ag:countWhere
[pred output-name]
......
......@@ -456,3 +456,16 @@
:breakout [$venue_category_name $user_name]
:order-by [[:asc [:aggregation 0]] [:asc $checkins.venue_category_name]]
:limit 5}))
;; Do we generate the correct count clause for HLL fields?
(datasets/expect-with-driver :druid
[["Bar" "Szymon Theutrich" 13]
["Mexican" "Dwight Gresham" 12]
["American" "Spiros Teofil" 10]
["Bar" "Felipinho Asklepios" 10]
["Bar" "Kaneonuskatew Eiran" 10]]
(druid-query-returning-rows
{:aggregation [[:aggregation-options [:count $checkins.user_name] {:name "__count_0"}]]
:breakout [$venue_category_name $user_name]
:order-by [[:desc [:aggregation 0]] [:asc $checkins.venue_category_name]]
:limit 5}))
......@@ -70,7 +70,9 @@
:format :auto}
:dimensionsSpec {:dimensions ["id"
"user_last_login"
"user_name"
{:name "user_name"
:type "string"
:isInputHyperUnique true}
"user_password"
"venue_category_name"
{:name "venue_latitude"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment