Skip to content

Use the natively supported version and usage by picocli#10672

Closed
jonas-grgt wants to merge 3 commits intoapache:masterfrom
jonas-grgt:use-native-picocli-for-version-and-help
Closed

Use the natively supported version and usage by picocli#10672
jonas-grgt wants to merge 3 commits intoapache:masterfrom
jonas-grgt:use-native-picocli-for-version-and-help

Conversation

@jonas-grgt
Copy link

@jonas-grgt jonas-grgt commented Apr 23, 2023

Instructions:

  1. The PR has to be tagged with at least one of the following labels (*):
    1. feature
    2. bugfix
  2. Remove these instructions before publishing the PR.

(*) Other labels to consider:

  • testing
  • refactor
  • cleanup

The general idea was to make use of the natively supported mixinStandardHelpOptions of picocli.

I took the liberty to add some tests for the PinotAdministrator.

Amy feedback more then welcome I'm happy to adjust the code in order to get it merged in and improve pinot!

@jonas-grgt jonas-grgt changed the title Use the natively supported version and usage by picocli [Draft] Use the natively supported version and usage by picocli Apr 23, 2023
@jonas-grgt jonas-grgt changed the title [Draft] Use the natively supported version and usage by picocli Use the natively supported version and usage by picocli Apr 24, 2023
@walterddr walterddr self-requested a review April 26, 2023 15:22
Copy link
Contributor

@walterddr walterddr left a comment

Choose a reason for hiding this comment

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

thank you for the PR, can you clean up the linter issue and submit again.

@jonas-grgt
Copy link
Author

thank you for the PR, can you clean up the linter issue and submit again.

I ran checkstyle and fixed all open issues.

@jonas-grgt
Copy link
Author

jonas-grgt commented May 2, 2023

thank you for the PR, can you clean up the linter issue and submit again.

There seems to be more then checkstyle in place. I suppose I need to get the built green. I'll look into it.

@codecov-commenter
Copy link

codecov-commenter commented May 2, 2023

Codecov Report

Merging #10672 (60ec1f8) into master (815cd6e) will increase coverage by 0.05%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##             master   #10672      +/-   ##
============================================
+ Coverage     64.38%   64.43%   +0.05%     
- Complexity     6441     6462      +21     
============================================
  Files          2068     2106      +38     
  Lines        111794   113512    +1718     
  Branches      16956    17262     +306     
============================================
+ Hits          71974    73137    +1163     
- Misses        34646    35122     +476     
- Partials       5174     5253      +79     
Flag Coverage Δ
unittests1 67.86% <0.00%> (-0.04%) ⬇️
unittests2 13.69% <0.00%> (-0.15%) ⬇️

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

Impacted Files Coverage Δ
...rc/main/java/org/apache/pinot/common/Versions.java 0.00% <0.00%> (ø)

... and 219 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jonas-grgt
Copy link
Author

jonas-grgt commented May 23, 2023

@walterddr Saw an attempt was made to built the project but, failed due to incompatibility with java 8.

Think I forgot to actually push my changes 🙈

In any case it should now pass, can you try again ?

Also what is the reason for supporting JDK-8 as a minimum version ?

@walterddr
Copy link
Contributor

Also what is the reason for supporting JDK-8 as a minimum version ?

I think it was because some users were still on JDK8. we are in the process of removing it (for a while unfortunately)
I will take another review later today. thank you for the contribution

Copy link
Contributor

@walterddr walterddr left a comment

Choose a reason for hiding this comment

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

did a brief pass through the PR. please kindly take a look at my comments.

thank you for addressing the JDK8 issue. it is tedious for sure

*/
package org.apache.pinot.tools.admin;

import java.io.StringWriter;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import java.io.StringWriter;
import com.google.common.collect.ImmutableMap;
import java.io.StringWriter;

static class VersionsStub extends Versions {
@Override
public Map<String, String> getComponentVersions() {
return new TreeMap<>(Map.of("AddSchema", "1.2.3", "AddTable", "1.2.4"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return new TreeMap<>(Map.of("AddSchema", "1.2.3", "AddTable", "1.2.4"));
return new TreeMap<>(ImmutableMap.of("AddSchema", "1.2.3", "AddTable", "1.2.4"));

pinotAdministrator.execute(new String[]{"AddSchema", "--help"});

// then
assertEquals(out.toString(), "Usage: <main class> AddSchema [-hV] [-exec] [-authToken=<_authToken>]\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

this assertEquals is going to be hard to maintain if we add additional commands. was wondering how other project use picocli handles unit-test? do we have a util to generate these expected results?

Comment on lines -123 to -128
+ " QueryRunner -mode singleThread -queryFile <queryFile> -numTimesToRunQueries 0 "
+ "-numIntervalsToReportAndClearStatistics 5\n"
+ " QueryRunner -mode multiThreads -queryFile <queryFile> -numThreads 10 -reportIntervalMs 1000\n"
+ " QueryRunner -mode targetQPS -queryFile <queryFile> -startQPS 50\n"
+ " QueryRunner -mode increasingQPS -queryFile <queryFile> -startQPS 50 -deltaQPS 10 "
+ "-numIntervalsToIncreaseQPS 20\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

did we missed these examples in the new format?

Comment on lines +85 to +88
// @Override
// public void getDescription() {
// System.out.println("mv [-o] <source-uri> <destination-uri>");
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

remove these comments if no longer needed

}

@Override
public void printExamples() {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this description refactored anywhere in the new code? can't find it

@jonas-grgt jonas-grgt closed this by deleting the head repository Nov 13, 2023
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