Skip to content

Use lower level Joda API in DateTimeTransformFunction#8414

Merged
richardstartin merged 1 commit intoapache:masterfrom
richardstartin:cache-chronology
Mar 25, 2022
Merged

Use lower level Joda API in DateTimeTransformFunction#8414
richardstartin merged 1 commit intoapache:masterfrom
richardstartin:cache-chronology

Conversation

@richardstartin
Copy link
Member

#8397 decreased allocation over 1000x and improved query time by ~30% for the query below evaluated over 2.5Bn events.

select count(*), year(event_time) as y, month(event_time) as m from githubEvents group by y, m

The high level API leads to looking up lots of Chronology objects:

Screenshot 2022-03-25 at 20 53 42

Joda has a slightly lower level API which allows 10-15% speedup by avoiding this, without taking on too much complexity.

Benchmark               (_numRows)                                                                             (_query)  (_scenario)  Mode  Cnt      Score       Error  Units
BenchmarkQueries.query     1500000  select count(*), year(INT_COL) as y, month(INT_COL) as m from MyTable group by y, m   EXP(0.001)  avgt    5  59405.445 ± 2239.678  us/op
BenchmarkQueries.query     1500000  select count(*), year(INT_COL) as y, month(INT_COL) as m from MyTable group by y, m     EXP(0.5)  avgt    5  60158.445 ± 1162.191  us/op
BenchmarkQueries.query     1500000  select count(*), year(INT_COL) as y, month(INT_COL) as m from MyTable group by y, m   EXP(0.999)  avgt    5  59735.354 ± 1363.752  us/op
Benchmark               (_numRows)                                                                             (_query)  (_scenario)  Mode  Cnt      Score      Error  Units
BenchmarkQueries.query     1500000  select count(*), year(INT_COL) as y, month(INT_COL) as m from MyTable group by y, m   EXP(0.001)  avgt    5  53623.538 ± 1757.387  us/op
BenchmarkQueries.query     1500000  select count(*), year(INT_COL) as y, month(INT_COL) as m from MyTable group by y, m     EXP(0.5)  avgt    5  54116.859 ± 2684.261  us/op
BenchmarkQueries.query     1500000  select count(*), year(INT_COL) as y, month(INT_COL) as m from MyTable group by y, m   EXP(0.999)  avgt    5  54359.302 ± 1790.208  us/op

@richardstartin richardstartin requested a review from xiangfu0 March 25, 2022 21:35
Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

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

Nice!

@richardstartin richardstartin changed the title Use lower level Joda API Use lower level Joda API in DateTimeTransformFunction Mar 25, 2022
@codecov-commenter
Copy link

codecov-commenter commented Mar 25, 2022

Codecov Report

Merging #8414 (14aaa99) into master (37fcfb8) will decrease coverage by 6.70%.
The diff coverage is 92.85%.

@@             Coverage Diff              @@
##             master    #8414      +/-   ##
============================================
- Coverage     70.77%   64.07%   -6.71%     
- Complexity     4278     4279       +1     
============================================
  Files          1655     1610      -45     
  Lines         86607    84784    -1823     
  Branches      13064    12864     -200     
============================================
- Hits          61296    54324    -6972     
- Misses        21068    26536    +5468     
+ Partials       4243     3924     -319     
Flag Coverage Δ
integration1 ?
integration2 ?
unittests1 66.98% <92.85%> (-0.02%) ⬇️
unittests2 14.13% <0.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../transform/function/DateTimeTransformFunction.java 89.24% <92.85%> (+0.63%) ⬆️
...va/org/apache/pinot/core/routing/RoutingTable.java 0.00% <0.00%> (-100.00%) ⬇️
...va/org/apache/pinot/common/config/NettyConfig.java 0.00% <0.00%> (-100.00%) ⬇️
...a/org/apache/pinot/common/metrics/MinionMeter.java 0.00% <0.00%> (-100.00%) ⬇️
...g/apache/pinot/common/metrics/ControllerMeter.java 0.00% <0.00%> (-100.00%) ⬇️
.../apache/pinot/common/metrics/BrokerQueryPhase.java 0.00% <0.00%> (-100.00%) ⬇️
.../apache/pinot/common/metrics/MinionQueryPhase.java 0.00% <0.00%> (-100.00%) ⬇️
...apache/pinot/common/helix/ExtraInstanceConfig.java 0.00% <0.00%> (-100.00%) ⬇️
...ache/pinot/server/access/AccessControlFactory.java 0.00% <0.00%> (-100.00%) ⬇️
...he/pinot/common/messages/SegmentReloadMessage.java 0.00% <0.00%> (-100.00%) ⬇️
... and 386 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37fcfb8...14aaa99. Read the comment docs.

Copy link
Contributor

@xiangfu0 xiangfu0 left a comment

Choose a reason for hiding this comment

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

Wow! Awesome!

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