Skip to content

fix ClassCastException when finalize hyperUnique metric in sql#10899

Closed
kaijianding wants to merge 1 commit intoapache:masterfrom
kaijianding:comp
Closed

fix ClassCastException when finalize hyperUnique metric in sql#10899
kaijianding wants to merge 1 commit intoapache:masterfrom
kaijianding:comp

Conversation

@kaijianding
Copy link
Contributor

Description

for a sql like this

select count(1) as totalData
from  (
   select count(distinct unique_user_id) as uv
   from a_table
   group by city_name
   order by uv
) t

unique_user_id is hyperUnique metric.

java.lang.ClassCastException is thrown as

java.lang.Long cannot be cast to java.lang.Double

The reason is that count(distinct unique_user_id) is Long in row signature, but the comparator in HyperUniqueFinalizingPostAggregator is Double


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

Key changed/added classes in this PR
  • HyperUniqueFinalizingPostAggregator

@kaijianding
Copy link
Contributor Author

The CI failure java.lang.AssertionError: expected [200 OK] but found [401 Unauthorized] in 30393.61 (Compile=openjdk8, Run=openjdk8, ZK=3.4) leadership and high availability integration tests should be unrelated

Copy link
Member

@clintropolis clintropolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good to me, any chance you can add a test that covers this case?

@kaijianding kaijianding closed this Jul 2, 2021
@kaijianding kaijianding deleted the comp branch July 2, 2021 12:29
@vivek-kandhvar
Copy link

Is this merged or just deleted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants