Skip to content

Granularity: Introduce primitive-typed bucketStart, increment methods. - #10904

Merged
gianm merged 3 commits into
apache:masterfrom
gianm:floor-expr-speedier
Feb 25, 2021
Merged

gianm merged 3 commits into
apache:masterfrom
gianm:floor-expr-speedier

Conversation

@gianm

@gianm gianm commented Feb 19, 2021

Copy link
Copy Markdown
Contributor

Saves creation of unnecessary DateTime objects in timestamp_floor and
timestamp_ceil expressions.

I was running a query that had a group by floor(__time to year) in it and was greeted by the following flame graph:

image

33% of the time is spent on DateTime.<init>. It's not necessary, because the PeriodGranularity code is doing the hard work on the primitive milliseconds.

Saves creation of unnecessary DateTime objects in timestamp_floor and
timestamp_ceil expressions.

@clintropolis clintropolis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice 🤘

@gianm

gianm commented Feb 25, 2021

Copy link
Copy Markdown
Contributor Author

It looks like the CI failure was in the coverage checker. I pushed a new patch that improves test coverage.

@gianm
gianm merged commit 07902f6 into apache:master Feb 25, 2021
@gianm
gianm deleted the floor-expr-speedier branch February 25, 2021 15:59
@clintropolis clintropolis added this to the 0.22.0 milestone Aug 12, 2021
riovic918data pushed a commit to riovic918data/druid that referenced this pull request Jun 12, 2026
apache#10904)

* Granularity: Introduce primitive-typed bucketStart, increment methods.

Saves creation of unnecessary DateTime objects in timestamp_floor and
timestamp_ceil expressions.

* Fix style.

* Amp up the test coverage.
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.

2 participants