citusdata / citusdata/citus

Approximate count(distinct) queries use hll as their intermediate data type. We have a mismatch between hll target entry and sort clause's sortop oid, so we can't push an order by on the hll data type to worker nodes.

Open
#140 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

When enabled, count(distinct) approximation uses hll as the intermediate data type. We currently have a mismatch between hll target entry and sort clause's sortop oid, so we can't push an order by on the hll data type to the worker node. One fix is changing eqop and sortop oids of sort clause when we change the underlying data type.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Citus planner path for approximate count(distinct) queries and how hll target entries are matched to sort clauses. Reproduce the mismatch with an order by on the approximate result, then verify that the order by can be pushed to worker nodes with consistent eqop and sortop OIDs.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, postgresql
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.