This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-mr.git
The following commit(s) were added to refs/heads/master by this push:
new 0560584 PARQUET-1910 fix broken cli (#814)
0560584 is described below
commit 05605840dc6f45bbdb9ff9d730d5cbf996747454
Author: grishaw <[email protected]>
AuthorDate: Wed Oct 21 23:14:52 2020 +0300
PARQUET-1910 fix broken cli (#814)
Co-authored-by: Grisha Weintraub <[email protected]>
---
.../cli/commands/TransCompressionCommand.java | 10 +++--
.../test/java/org/apache/parquet/cli/MainTest.java | 34 ++++++++++++++++
.../cli/commands/TransCompressionCommandTest.java | 45 ++++++++++++++++++++++
3 files changed, 86 insertions(+), 3 deletions(-)
diff --git
a/parquet-cli/src/main/java/org/apache/parquet/cli/commands/TransCompressionCommand.java
b/parquet-cli/src/main/java/org/apache/parquet/cli/commands/TransCompressionCommand.java
index cae6810..fba64c2 100644
---
a/parquet-cli/src/main/java/org/apache/parquet/cli/commands/TransCompressionCommand.java
+++
b/parquet-cli/src/main/java/org/apache/parquet/cli/commands/TransCompressionCommand.java
@@ -54,10 +54,14 @@ public class TransCompressionCommand extends BaseCommand {
@Parameter(description = "<input parquet file path>")
String input;
- @Parameter(description = "<output parquet file path>")
+ @Parameter(
+ names={"-o", "--output"},
+ description = "<output parquet file path>")
String output;
- @Parameter(description = "<new compression codec")
+ @Parameter(
+ names = {"-c", "--compression-codec"},
+ description = "<new compression codec")
String codec;
@Override
@@ -90,7 +94,7 @@ public class TransCompressionCommand extends BaseCommand {
public List<String> getExamples() {
return Lists.newArrayList(
"# Translate the compression from one to another",
- " input.parquet output.parquet ZSTD"
+ " input.parquet -o output.parquet -c ZSTD"
);
}
}
diff --git a/parquet-cli/src/test/java/org/apache/parquet/cli/MainTest.java
b/parquet-cli/src/test/java/org/apache/parquet/cli/MainTest.java
new file mode 100644
index 0000000..9d090c3
--- /dev/null
+++ b/parquet-cli/src/test/java/org/apache/parquet/cli/MainTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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 org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.ToolRunner;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.LoggerFactory;
+
+public class MainTest {
+
+ @Test
+ public void mainTest() throws Exception {
+ ToolRunner.run(new Configuration(), new
Main(LoggerFactory.getLogger(MainTest.class)), new String[]{});
+ Assert.assertTrue("we simply verify there are no errors here", true);
+ }
+}
diff --git
a/parquet-cli/src/test/java/org/apache/parquet/cli/commands/TransCompressionCommandTest.java
b/parquet-cli/src/test/java/org/apache/parquet/cli/commands/TransCompressionCommandTest.java
new file mode 100644
index 0000000..3bc1d50
--- /dev/null
+++
b/parquet-cli/src/test/java/org/apache/parquet/cli/commands/TransCompressionCommandTest.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.commands;
+
+import org.apache.hadoop.conf.Configuration;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+
+public class TransCompressionCommandTest extends ParquetFileTest{
+
+ @Test
+ public void testTransCompressionCommand() throws IOException {
+ TransCompressionCommand command = new
TransCompressionCommand(createLogger());
+
+ command.input = parquetFile().getAbsolutePath();
+
+ File output = new File(getTempFolder(), getClass().getSimpleName() +
".converted.parquet");
+ command.output = output.getAbsolutePath();
+ command.codec = "ZSTD";
+ command.setConf(new Configuration());
+
+ Assert.assertEquals(0, command.run());
+ Assert.assertTrue(output.exists());
+ }
+
+}