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
ORC-1305: Add CompressionWriter
and InMemoryEncryption[Reader|Writer]
examples
#1302
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make the CI happy after checking the result of mvn checkstyle:check -Panalyze -Pbenchmark
?
Hi @dongjoon-hyun , seem that the CI is successful now. Could you help me take a look at it? Thank you~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 LGTM
Thank you @guiyanakuang |
java/examples/src/java/org/apache/orc/examples/CompressionWriter.java
Outdated
Show resolved
Hide resolved
java/examples/src/java/org/apache/orc/examples/InMemoryCryptionReader.java
Outdated
Show resolved
Hide resolved
java/examples/src/java/org/apache/orc/examples/InMemoryCryptionWriter.java
Outdated
Show resolved
Hide resolved
java/examples/src/java/org/apache/orc/examples/InMemoryCryptionWriter.java
Outdated
Show resolved
Hide resolved
java/examples/src/java/org/apache/orc/examples/InMemoryCryptionReader.java
Outdated
Show resolved
Hide resolved
import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; | ||
import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; | ||
import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; | ||
import org.apache.orc.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer to enumerate the import statements explicitly because most modern IDEs hide this section intelligently.
-import org.apache.orc.*;
+import org.apache.orc.EncryptionAlgorithm;
+import org.apache.orc.InMemoryKeystore;
+import org.apache.orc.OrcFile;
+import org.apache.orc.Reader;
+import org.apache.orc.RecordReader;
+import org.apache.orc.TypeDescription;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me add these rules to checkstyle.xml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me add these rules to checkstyle.xml.
+1 Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I found that intellij does this "optimization" when it tries to import from the same directory 5 times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, you need to override it, @deshanxiao .
java/examples/src/java/org/apache/orc/examples/InMemoryCryptionWriter.java
Outdated
Show resolved
Hide resolved
java/examples/src/java/org/apache/orc/examples/InMemoryCryptionWriter.java
Outdated
Show resolved
Hide resolved
java/examples/src/java/org/apache/orc/examples/InMemoryCryptionWriter.java
Outdated
Show resolved
Hide resolved
import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; | ||
import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; | ||
import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; | ||
import org.apache.orc.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Thanks for @guiyanakuang suggestion. I have added the rule. If someone try to use import *, He/She will get an error. |
Thank you for doing this, but make sure that each pr has a single purpose. We'd better use another pr to implement it. |
Thanks, let me remove it. |
Thank you for the update. Could you rebase this PR, @deshanxiao ? I merged the indentation PR to the |
c456542
to
ae47b4c
Compare
CompressionWriter
and InMemoryEncryption[Reader|Writer]
examples
public class CompressionWriter { | ||
public static void main(Configuration conf, String[] args) throws IOException { | ||
TypeDescription schema = | ||
TypeDescription.fromString("struct<x:int,y:string>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use 4-space indentation, @deshanxiao .
Line 64 in 9cf9d26
<property name="lineWrappingIndentation" value="4"/> |
cc @guiyanakuang , the current rule seems to unable to prevent this case because we don't have forceStrictCondition=true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't notice that. I re-verified the case of forceStrictCondition=true
.
orc-core added 1206 Checkstyle violation. Mainly dangling method parameter definitions in strict mode are also treated as violations.
Like this.
public static Reader createReader(Path path,
ReaderOptions options) throws IOException {
return new ReaderImpl(path, options);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, I also tried that and found it's too intrusive at this time, @guiyanakuang .
java/examples/src/java/org/apache/orc/examples/CompressionWriter.java
Outdated
Show resolved
Hide resolved
java/examples/src/java/org/apache/orc/examples/InMemoryEncryptionReader.java
Outdated
Show resolved
Hide resolved
java/examples/src/java/org/apache/orc/examples/InMemoryEncryptionReader.java
Outdated
Show resolved
Hide resolved
java/examples/src/java/org/apache/orc/examples/InMemoryEncryptionReader.java
Outdated
Show resolved
Hide resolved
import java.io.IOException; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
public class InMemoryEncryptionWriter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same comments like InMemoryEncryptionReader
.
I finished another round of reviews. Could you check my comments, @deshanxiao ? |
Sure, sorry for my format mistakes, I will check it again, thank you. |
ae47b4c
to
fdcd7c4
Compare
I have done all the comments. Thank you for your very careful review! @dongjoon-hyun |
Thank you for updates, @deshanxiao . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, LGTM (Pending CIs)
…er]` examples ### What changes were proposed in this pull request? This PR is aimed to add more java examples. ### Why are the changes needed? We need more examples in **InMemoryCryption** and **Compression**. ### How was this patch tested? UT Closes #1302 from deshanxiao/deshan/add-more-example. Authored-by: deshanxiao <deshanxiao@microsoft.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit 31acaaa) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
I merged this to main/1.8 for Apache ORC 1.8.1 release because this is an example instead of |
Thank you @dongjoon-hyun @guiyanakuang @wgtmac |
…er]` examples ### What changes were proposed in this pull request? This PR is aimed to add more java examples. ### Why are the changes needed? We need more examples in **InMemoryCryption** and **Compression**. ### How was this patch tested? UT Closes apache#1302 from deshanxiao/deshan/add-more-example. Authored-by: deshanxiao <deshanxiao@microsoft.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
What changes were proposed in this pull request?
This PR is aimed to add more java examples.
Why are the changes needed?
We need more examples in InMemoryCryption and Compression.
How was this patch tested?
UT