Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix backward compatible issue in DistinctCountThetaSketchAggregationFunction #12347

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

jackjlli
Copy link
Contributor

@jackjlli jackjlli commented Feb 1, 2024

This PR fixes a backward incompatible issue introduced by this PR: #12042

Printed stacktrace from the broker log:

Caused by: java.lang.ClassCastException: class org.apache.datasketches.theta.DirectCompactSketch cannot be cast to class org.apache.pinot.segment.local.customobject.ThetaSketchAccumulator (org.apache.datasketches.theta.DirectCompactSketch and org.apache.pinot.segment.local.customobject.ThetaSketchAccumulator are in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @3b2f4a93)
        at org.apache.pinot.core.query.aggregation.function.DistinctCountThetaSketchAggregationFunction.extractFinalResult(DistinctCountThetaSketchAggregationFunction.java:1019) ~[org.apache.pinot.pinot-core.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.core.query.aggregation.function.DistinctCountThetaSketchAggregationFunction.extractFinalResult(DistinctCountThetaSketchAggregationFunction.java:82) ~[org.apache.pinot.pinot-core.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.core.data.table.TableResizer$AggregationFunctionExtractor.extract(TableResizer.java:446) ~[org.apache.pinot.pinot-core.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.core.data.table.TableResizer.getIntermediateRecord(TableResizer.java:169) ~[org.apache.pinot.pinot-core.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.core.data.table.TableResizer.getSortedTopRecords(TableResizer.java:280) ~[org.apache.pinot.pinot-core.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.core.data.table.TableResizer.getTopRecords(TableResizer.java:266) ~[org.apache.pinot.pinot-core.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.core.data.table.IndexedTable.finish(IndexedTable.java:151) ~[org.apache.pinot.pinot-core.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.core.data.table.Table.finish(Table.java:59) ~[org.apache.pinot.pinot-core.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.core.query.reduce.GroupByDataTableReducer.getIndexedTable(GroupByDataTableReducer.java:386) ~[org.apache.pinot.pinot-core.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.core.query.reduce.GroupByDataTableReducer.reduceWithIntermediateResult(GroupByDataTableReducer.java:146) ~[org.apache.pinot.pinot-core.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.core.query.reduce.GroupByDataTableReducer.reduceAndSetResults(GroupByDataTableReducer.java:114) ~[org.apache.pinot.pinot-core.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.core.query.reduce.BrokerReduceService.reduceOnDataTable(BrokerReduceService.java:158) ~[org.apache.pinot.pinot-core.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.broker.requesthandler.SingleConnectionBrokerRequestHandler.processBrokerRequest(SingleConnectionBrokerRequestHandler.java:150) ~[org.apache.pinot.pinot-broker.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.broker.requesthandler.BaseBrokerRequestHandler.handleRequest(BaseBrokerRequestHandler.java:766) ~[org.apache.pinot.pinot-broker.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.broker.requesthandler.BaseBrokerRequestHandler.handleRequest(BaseBrokerRequestHandler.java:282) ~[org.apache.pinot.pinot-broker.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.broker.requesthandler.BrokerRequestHandlerDelegate.handleRequest(BrokerRequestHandlerDelegate.java:107) ~[org.apache.pinot.pinot-broker.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]
        at org.apache.pinot.broker.requesthandler.BrokerRequestHandler.handleRequest(BrokerRequestHandler.java:48) ~[org.apache.pinot.pinot-broker.jar:1.1.0e54888f597105216666ee3b0f4d28596434e9652]

@jackjlli jackjlli force-pushed the fix-DistinctCountThetaSketchAggregationFunction branch from 577e5e2 to db75e44 Compare February 1, 2024 17:54
@codecov-commenter
Copy link

codecov-commenter commented Feb 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (17db0fd) 61.69% compared to head (db75e44) 61.76%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #12347      +/-   ##
============================================
+ Coverage     61.69%   61.76%   +0.06%     
- Complexity      207     1152     +945     
============================================
  Files          2424     2424              
  Lines        132340   132498     +158     
  Branches      20436    20479      +43     
============================================
+ Hits          81651    81834     +183     
+ Misses        44693    44657      -36     
- Partials       5996     6007      +11     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 61.67% <100.00%> (+26.65%) ⬆️
java-21 61.64% <100.00%> (+0.06%) ⬆️
skip-bytebuffers-false 61.71% <100.00%> (+0.02%) ⬆️
skip-bytebuffers-true 61.61% <100.00%> (+0.05%) ⬆️
temurin 61.76% <100.00%> (+0.06%) ⬆️
unittests 61.75% <100.00%> (+0.06%) ⬆️
unittests1 46.91% <100.00%> (+<0.01%) ⬆️
unittests2 27.72% <0.00%> (+0.09%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -53,7 +53,8 @@ public String extractFinalResult(List<ThetaSketchAccumulator> accumulators) {
int numAccumulators = accumulators.size();
List<Sketch> mergedSketches = new ArrayList<>(numAccumulators);

for (ThetaSketchAccumulator accumulator : accumulators) {
for (Object object : accumulators) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we please test this if this indeeds helps?

As discussed offline, as a result of the aggregationFunction.merge() step, all Sketch objects should be converted to ThetaSketchAccumulator. So can you clarify why we saw this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question! It could be possible that there is only 1 old server returning a non-empty intermediate result, which skipped the merge step in broker.

I've tested this code by setting up a local cluster and running 2 servers with old version and 1 broker with new version, and I don't see exception any more. So we should be good with this hotfix PR.

@jackjlli jackjlli merged commit 5c81c0a into master Feb 5, 2024
19 checks passed
@jackjlli jackjlli deleted the fix-DistinctCountThetaSketchAggregationFunction branch February 5, 2024 23:14
suyashpatel98 pushed a commit to suyashpatel98/pinot that referenced this pull request Feb 28, 2024
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