Skip to content

Conversation

@jtuglu1
Copy link
Contributor

@jtuglu1 jtuglu1 commented Jan 6, 2026

Description

Adds Spectator SQL functions:

  • SPECTATOR_COUNT returns the # of distinct events inside the histogram (either pre/post aggregated).
  • SPECTATOR_PERCENTILE allows computing single/multiple percentiles over a histogram column (either pre/post aggregated).

Release note

Add SPECTATOR_COUNT and SPECTATOR_PERCENTILE SQL functions for operating on Spectator Histograms.


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • 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.

.buildMMappedIndex();

return walker.add(
DataSegment.builder()

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
DataSegment.builder
should be avoided because it has been deprecated.
@jtuglu1 jtuglu1 force-pushed the spectator-histogram-sql-functions branch 3 times, most recently from 3beeb2d to ba5d493 Compare January 6, 2026 05:50
@jtuglu1 jtuglu1 force-pushed the spectator-histogram-sql-functions branch from ba5d493 to 1c9f2ed Compare January 6, 2026 06:24
@jtuglu1 jtuglu1 marked this pull request as ready for review January 6, 2026 17:16
@jtuglu1 jtuglu1 force-pushed the spectator-histogram-sql-functions branch from 1c9f2ed to cccacaf Compare January 6, 2026 17:30
@jtuglu1 jtuglu1 requested a review from maytasm January 6, 2026 17:31
@jtuglu1 jtuglu1 requested a review from abhishekrb19 January 6, 2026 17:58
@jtuglu1 jtuglu1 force-pushed the spectator-histogram-sql-functions branch from e39924b to b8369f2 Compare January 6, 2026 18:53
@jtuglu1 jtuglu1 force-pushed the spectator-histogram-sql-functions branch from b8369f2 to a6be0c7 Compare January 6, 2026 19:15
@jtuglu1 jtuglu1 closed this Jan 6, 2026
@jtuglu1 jtuglu1 reopened this Jan 6, 2026
@jtuglu1 jtuglu1 requested a review from jasonk000 January 6, 2026 23:25
@jtuglu1 jtuglu1 merged commit dcd3d87 into apache:master Jan 7, 2026
43 checks passed
*/
public class SpectatorHistogramCountSqlAggregator implements SqlAggregator
{
private static final SqlAggFunction FUNCTION_INSTANCE = new SpectatorHistogramCountSqlAggFunction();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: use OperatorConversions.aggregatorBuilder (easier to read compare to SqlAggFunction's constructor)

*/
public class SpectatorHistogramPercentileSqlAggregator implements SqlAggregator
{
private static final SqlAggFunction FUNCTION_INSTANCE = new SpectatorHistogramPercentileSqlAggFunction();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: use OperatorConversions.aggregatorBuilder (easier to read compare to SqlAggFunction's constructor)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants