Skip to content

Add ServerRouteInfo to replace pairs maintaining the same info.#14921

Merged
Jackie-Jiang merged 9 commits intoapache:masterfrom
vrajat:rv-server-execution-info
Jan 28, 2025
Merged

Add ServerRouteInfo to replace pairs maintaining the same info.#14921
Jackie-Jiang merged 9 commits intoapache:masterfrom
vrajat:rv-server-execution-info

Conversation

@vrajat
Copy link
Copy Markdown
Contributor

@vrajat vrajat commented Jan 27, 2025

Cleans up code to replace a Pair<List<String>, List<String> with a more informative POJO class -ServerRouteInfo. The pair encapsulated two lists of segments - required and optional which is used by different parts of Pinot. When reading the code, it is not obvious what Pair.getLeft and Pair.getRight is meant for without reading the function that creates this list.

@vrajat vrajat requested a review from Jackie-Jiang January 27, 2025 05:25
@vrajat vrajat added cleanup Code cleanup or removal of dead code code-style Related to code formatting or style conventions labels Jan 27, 2025
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 27, 2025

Codecov Report

Attention: Patch coverage is 60.60606% with 13 lines in your changes missing coverage. Please review.

Project coverage is 63.72%. Comparing base (59551e4) to head (f80ec5f).
Report is 1638 commits behind head on master.

Files with missing lines Patch % Lines
...che/pinot/broker/routing/BrokerRoutingManager.java 57.14% 3 Missing ⚠️
...e/pinot/broker/api/resources/PinotBrokerDebug.java 0.00% 2 Missing ⚠️
...roker/requesthandler/GrpcBrokerRequestHandler.java 0.00% 2 Missing ⚠️
...a/org/apache/pinot/core/transport/QueryRouter.java 60.00% 1 Missing and 1 partial ⚠️
...sthandler/BaseSingleStageBrokerRequestHandler.java 80.00% 1 Missing ⚠️
...r/spark/common/reader/PinotServerDataFetcher.scala 0.00% 1 Missing ⚠️
.../org/apache/pinot/query/routing/WorkerManager.java 75.00% 0 Missing and 1 partial ⚠️
.../pinot/tsdb/planner/physical/TableScanVisitor.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #14921      +/-   ##
============================================
+ Coverage     61.75%   63.72%   +1.97%     
- Complexity      207     1470    +1263     
============================================
  Files          2436     2712     +276     
  Lines        133233   151706   +18473     
  Branches      20636    23416    +2780     
============================================
+ Hits          82274    96672   +14398     
- Misses        44911    47777    +2866     
- Partials       6048     7257    +1209     
Flag Coverage Δ
custom-integration1 100.00% <ø> (+99.99%) ⬆️
integration 100.00% <ø> (+99.99%) ⬆️
integration1 100.00% <ø> (+99.99%) ⬆️
integration2 0.00% <ø> (ø)
java-11 56.21% <75.00%> (-5.50%) ⬇️
java-21 63.62% <60.60%> (+1.99%) ⬆️
skip-bytebuffers-false 63.71% <60.60%> (+1.96%) ⬆️
skip-bytebuffers-true 63.58% <60.60%> (+35.86%) ⬆️
temurin 63.72% <60.60%> (+1.97%) ⬆️
unittests 63.71% <60.60%> (+1.97%) ⬆️
unittests1 56.26% <75.00%> (+9.37%) ⬆️
unittests2 34.03% <39.39%> (+6.30%) ⬆️

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.

Copy link
Copy Markdown
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.

Thanks for cleaning it up!

* @param segmentList List of segments assigned to the server.
* @param optionalSegmentList List of optional segments assigned to the server.
*/
@JsonCreator
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to ser/de this class?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed. The API worked without it

Comment on lines +30 to +31
private final List<String> _segmentList;
private final List<String> _optionalSegmentList;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(optional) More concise

Suggested change
private final List<String> _segmentList;
private final List<String> _optionalSegmentList;
private final List<String> _segments;
private final List<String> _optionalSegments;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed

Pair<List<String>, List<String>> pair =
merged.computeIfAbsent(serverInstance, k -> Pair.of(new ArrayList<>(), new ArrayList<>()));
pair.getLeft().add(entry.getKey());
ServerRouteInfo executionInfo =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rename it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@vrajat vrajat changed the title Add ServerExecutionInfo to replace pairs maintaining the same info. Add ServerRouteInfo to replace pairs maintaining the same info. Jan 28, 2025
@vrajat
Copy link
Copy Markdown
Contributor Author

vrajat commented Jan 28, 2025

test failure is in an unrelated test suite.

@Jackie-Jiang Jackie-Jiang merged commit 1edffab into apache:master Jan 28, 2025
zeronerdzerogeekzerocool pushed a commit to zeronerdzerogeekzerocool/pinot that referenced this pull request Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code cleanup or removal of dead code code-style Related to code formatting or style conventions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants