You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@parquet.apache.org by "pan3793 (via GitHub)" <gi...@apache.org> on 2025/06/03 07:17:59 UTC
[PR] GH-3233: Parquet CLI supports version command [parquet-java]
pan3793 opened a new pull request, #3234:
URL: https://github.com/apache/parquet-java/pull/3234
<!--
Thanks for opening a pull request!
If you're new to Parquet-Java, information on how to contribute can be found here: https://parquet.apache.org/docs/contribution-guidelines/contributing
Please open a GitHub issue for this pull request: https://github.com/apache/parquet-java/issues/new/choose
and format pull request title as below:
GH-${GITHUB_ISSUE_ID}: ${SUMMARY}
or simply use the title below if it is a minor issue:
MINOR: ${SUMMARY}
-->
### Rationale for this change
Follow the convention for the CLI tools to add a `version` command.
### What changes are included in this PR?
As title.
### Are these changes tested?
UT added, also tested manually
```
$ java -cp 'target/parquet-cli-1.16.0-SNAPSHOT.jar:target/dependency/*' org.apache.parquet.cli.Main version
parquet-mr version 1.16.0-SNAPSHOT (build eb65987333a6bb2ae729b88eef0d6f941a7c1867)
```
### Are there any user-facing changes?
Yes.
<!-- Please uncomment the line below and replace ${GITHUB_ISSUE_ID} with the actual Github issue id. -->
Closes #3233
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] GH-3233: Parquet CLI supports version command [parquet-java]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #3234:
URL: https://github.com/apache/parquet-java/pull/3234#discussion_r2123283898
##########
parquet-cli/src/main/java/org/apache/parquet/cli/ShowVersionCommand.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet.cli;
+
+import com.beust.jcommander.*;
Review Comment:
addressed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] GH-3233: Parquet CLI supports version command [parquet-java]
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac merged PR #3234:
URL: https://github.com/apache/parquet-java/pull/3234
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] GH-3233: Parquet CLI supports version command [parquet-java]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #3234:
URL: https://github.com/apache/parquet-java/pull/3234#discussion_r2123260121
##########
parquet-cli/src/main/java/org/apache/parquet/cli/ShowVersionCommand.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet.cli;
+
+import com.beust.jcommander.*;
+import java.util.List;
+import org.apache.parquet.Version;
+import org.slf4j.Logger;
+
+@Parameters(commandDescription = "Print version of the Parquet CLI tool")
+public class ShowVersionCommand implements Command {
+
+ private final Logger console;
+
+ public ShowVersionCommand(Logger console) {
+ this.console = console;
+ }
+
+ @Override
+ public int run() {
+ console.info(Version.FULL_VERSION);
+ return 0;
+ }
+
+ @Override
+ public List<String> getExamples() {
+ return null;
Review Comment:
Thanks for taking a look, I copied it from `Help#getExamples`. Anyway, avoiding NULL propagation is generally a good idea, let me update both.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] GH-3233: Parquet CLI supports version command [parquet-java]
Posted by "nandorKollar (via GitHub)" <gi...@apache.org>.
nandorKollar commented on code in PR #3234:
URL: https://github.com/apache/parquet-java/pull/3234#discussion_r2123255088
##########
parquet-cli/src/main/java/org/apache/parquet/cli/ShowVersionCommand.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet.cli;
+
+import com.beust.jcommander.*;
Review Comment:
nit: I think we usually avoid * imports
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] GH-3233: Parquet CLI supports version command [parquet-java]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #3234:
URL: https://github.com/apache/parquet-java/pull/3234#issuecomment-2934024458
@wgtmac it's a different thing, `Created by` represents the version of Parquet lib used to write the Parquet file, while this command prints the Parquet CLI tool's version.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] GH-3233: Parquet CLI supports version command [parquet-java]
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on PR #3234:
URL: https://github.com/apache/parquet-java/pull/3234#issuecomment-2933986895
Isn't it already displayed by the `Created by` line from running the `meta` command?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] GH-3233: Parquet CLI supports version command [parquet-java]
Posted by "nandorKollar (via GitHub)" <gi...@apache.org>.
nandorKollar commented on code in PR #3234:
URL: https://github.com/apache/parquet-java/pull/3234#discussion_r2123240566
##########
parquet-cli/src/main/java/org/apache/parquet/cli/ShowVersionCommand.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet.cli;
+
+import com.beust.jcommander.*;
+import java.util.List;
+import org.apache.parquet.Version;
+import org.slf4j.Logger;
+
+@Parameters(commandDescription = "Print version of the Parquet CLI tool")
+public class ShowVersionCommand implements Command {
+
+ private final Logger console;
+
+ public ShowVersionCommand(Logger console) {
+ this.console = console;
+ }
+
+ @Override
+ public int run() {
+ console.info(Version.FULL_VERSION);
+ return 0;
+ }
+
+ @Override
+ public List<String> getExamples() {
+ return null;
Review Comment:
nit: probably doesn't matter much, but other commands without examples return empty array list instead of null (`Lists.newArrayList()` or maybe even better `Collections.EMPTY_LIST`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] GH-3233: Parquet CLI supports version command [parquet-java]
Posted by "nandorKollar (via GitHub)" <gi...@apache.org>.
nandorKollar commented on code in PR #3234:
URL: https://github.com/apache/parquet-java/pull/3234#discussion_r2123257163
##########
parquet-cli/src/main/java/org/apache/parquet/cli/ShowVersionCommand.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet.cli;
+
+import com.beust.jcommander.*;
+import java.util.List;
+import org.apache.parquet.Version;
+import org.slf4j.Logger;
+
+@Parameters(commandDescription = "Print version of the Parquet CLI tool")
+public class ShowVersionCommand implements Command {
Review Comment:
Why didn't you inherit from BaseCommand? I believe console is already present there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] GH-3233: Parquet CLI supports version command [parquet-java]
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on PR #3234:
URL: https://github.com/apache/parquet-java/pull/3234#issuecomment-2934128676
Ah, thanks for the clarification! Since this is a parameter for the tool itself, what about following style of the help command like below? Perhaps we need to add alias `-v`, `-version` and `--version`.
```
jc.addCommand("help", help, "-h", "-help", "--help");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] GH-3233: Parquet CLI supports version command [parquet-java]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #3234:
URL: https://github.com/apache/parquet-java/pull/3234#issuecomment-2934239709
@wgtmac `-v` is already used by `--verbose`, I added aliases `-version`, `--version`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] GH-3233: Parquet CLI supports version command [parquet-java]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #3234:
URL: https://github.com/apache/parquet-java/pull/3234#discussion_r2123273173
##########
parquet-cli/src/main/java/org/apache/parquet/cli/ShowVersionCommand.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet.cli;
+
+import com.beust.jcommander.*;
+import java.util.List;
+import org.apache.parquet.Version;
+import org.slf4j.Logger;
+
+@Parameters(commandDescription = "Print version of the Parquet CLI tool")
+public class ShowVersionCommand implements Command {
Review Comment:
because the "version" is quite a simple command that does not require accessing a parquet file, so inheriting from BaseCommand does not help, but I can change that for consistency
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org