You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by do...@apache.org on 2021/09/03 01:23:16 UTC

[orc] branch main updated: ORC-981: Add `CommentsIndentation` checkstyle rule (#894)

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new 5ae64d7  ORC-981: Add `CommentsIndentation` checkstyle rule (#894)
5ae64d7 is described below

commit 5ae64d794dcef613950f40d2aa2b61b295f72875
Author: William Hyun <wi...@apache.org>
AuthorDate: Thu Sep 2 18:23:13 2021 -0700

    ORC-981: Add `CommentsIndentation` checkstyle rule (#894)
    
    ### What changes were proposed in this pull request?
    
    This PR aims to add the `CommentsIndentation` checkstyle rule
    
    ### Why are the changes needed?
    
    This will fix misaligned comments and enforce it.
    
    ### How was this patch tested?
    
    Pass the CIs.
---
 .../src/java/org/apache/orc/InMemoryKeystore.java  | 30 +++++++++++-----------
 java/core/src/java/org/apache/orc/OrcFile.java     | 10 ++++----
 .../apache/orc/impl/ConvertTreeReaderFactory.java  |  4 +--
 .../src/java/org/apache/orc/impl/InStream.java     |  8 +++---
 .../java/org/apache/orc/impl/IntegerReader.java    |  8 +++---
 .../org/apache/orc/impl/writer/CharTreeWriter.java |  2 +-
 java/pom.xml                                       |  1 +
 7 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/java/core/src/java/org/apache/orc/InMemoryKeystore.java b/java/core/src/java/org/apache/orc/InMemoryKeystore.java
index 8ef4c2a..743e305 100644
--- a/java/core/src/java/org/apache/orc/InMemoryKeystore.java
+++ b/java/core/src/java/org/apache/orc/InMemoryKeystore.java
@@ -256,21 +256,21 @@ public class InMemoryKeystore implements KeyProvider {
     return addKey(keyName, 0, algorithm, masterKey);
   }
 
-    /**
-     * Function that takes care of adding a new key.<br>
-     * A new key can be added only if:
-     * <ul>
-     * <li>This is a new key and no prior key version exist.</li>
-     * <li>If the key exists (has versions), then the new version to be added should be greater than
-     * the version that already exists.</li>
-     * </ul>
-     *
-     * @param keyName   Name of the key to be added
-     * @param version   Key Version
-     * @param algorithm Algorithm used
-     * @param masterKey Master key
-     * @return this
-     */
+  /**
+   * Function that takes care of adding a new key.<br>
+   * A new key can be added only if:
+   * <ul>
+   * <li>This is a new key and no prior key version exist.</li>
+   * <li>If the key exists (has versions), then the new version to be added should be greater than
+   * the version that already exists.</li>
+   * </ul>
+   *
+   * @param keyName   Name of the key to be added
+   * @param version   Key Version
+   * @param algorithm Algorithm used
+   * @param masterKey Master key
+   * @return this
+   */
   public InMemoryKeystore addKey(String keyName, int version,
                                  EncryptionAlgorithm algorithm,
                                  byte[] masterKey) throws IOException {
diff --git a/java/core/src/java/org/apache/orc/OrcFile.java b/java/core/src/java/org/apache/orc/OrcFile.java
index e7a051c..704d430 100644
--- a/java/core/src/java/org/apache/orc/OrcFile.java
+++ b/java/core/src/java/org/apache/orc/OrcFile.java
@@ -164,11 +164,11 @@ public class OrcFile {
   public enum WriterVersion {
     // Java ORC Writer
     ORIGINAL(WriterImplementation.ORC_JAVA, 0),
-    HIVE_8732(WriterImplementation.ORC_JAVA, 1), // fixed stripe/file maximum
-                                                 // statistics & string statistics
-                                                 // use utf8 for min/max
-    HIVE_4243(WriterImplementation.ORC_JAVA, 2), // use real column names from
-                                                 // Hive tables
+    HIVE_8732(WriterImplementation.ORC_JAVA, 1), /**
+                                                  * fixed stripe/file maximum statistics and
+                                                  * string statistics to use utf8 for min/max
+                                                  */
+    HIVE_4243(WriterImplementation.ORC_JAVA, 2), // use real column names from Hive tables
     HIVE_12055(WriterImplementation.ORC_JAVA, 3), // vectorized writer
     HIVE_13083(WriterImplementation.ORC_JAVA, 4), // decimals write present stream correctly
     ORC_101(WriterImplementation.ORC_JAVA, 5),   // bloom filters use utf8
diff --git a/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java b/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
index bdff28d..91bcacd 100644
--- a/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
+++ b/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
@@ -265,7 +265,7 @@ public class ConvertTreeReaderFactory extends TreeReaderFactory {
 
     @Override
     public void seek(PositionProvider[] index, ReadPhase readPhase) throws IOException {
-     // Pass-thru.
+      // Pass-thru.
       fromReader.seek(index, readPhase);
     }
 
@@ -2421,7 +2421,7 @@ public class ConvertTreeReaderFactory extends TreeReaderFactory {
     case VARCHAR:
       switch (readerType.getCategory()) {
       // Not currently supported conversion(s):
-        // (None)
+      // (None)
       default:
         return true;
       }
diff --git a/java/core/src/java/org/apache/orc/impl/InStream.java b/java/core/src/java/org/apache/orc/impl/InStream.java
index 06fd6ab..e6da6d4 100644
--- a/java/core/src/java/org/apache/orc/impl/InStream.java
+++ b/java/core/src/java/org/apache/orc/impl/InStream.java
@@ -68,10 +68,10 @@ public abstract class InStream extends InputStream {
    */
   protected abstract void setCurrent(DiskRangeList newRange,
                                      boolean isJump);
-    /**
-     * Reset the input to a new set of data.
-     * @param input the input data
-     */
+  /**
+   * Reset the input to a new set of data.
+   * @param input the input data
+   */
   protected void reset(DiskRangeList input) {
     bytes = input;
     while (input != null &&
diff --git a/java/core/src/java/org/apache/orc/impl/IntegerReader.java b/java/core/src/java/org/apache/orc/impl/IntegerReader.java
index 980b573..39ec7cd 100644
--- a/java/core/src/java/org/apache/orc/impl/IntegerReader.java
+++ b/java/core/src/java/org/apache/orc/impl/IntegerReader.java
@@ -62,10 +62,10 @@ public interface IntegerReader {
    * @param length the number of numbers to read
    * @throws IOException
    */
-   void nextVector(ColumnVector column,
-                   long[] data,
-                   int length
-                   ) throws IOException;
+  void nextVector(ColumnVector column,
+                  long[] data,
+                  int length
+                  ) throws IOException;
 
   /**
    * Return the next available vector for values. Does not change the
diff --git a/java/core/src/java/org/apache/orc/impl/writer/CharTreeWriter.java b/java/core/src/java/org/apache/orc/impl/writer/CharTreeWriter.java
index 83a72e9..8e2a287 100644
--- a/java/core/src/java/org/apache/orc/impl/writer/CharTreeWriter.java
+++ b/java/core/src/java/org/apache/orc/impl/writer/CharTreeWriter.java
@@ -57,7 +57,7 @@ public class CharTreeWriter extends StringBaseTreeWriter {
       for(int i=0; i < length; ++i) {
         if (vec.noNulls || !vec.isNull[i + offset]) {
           // offset + i, once per loop
-         writePadded(vec, i + offset, 1);
+          writePadded(vec, i + offset, 1);
         }
       }
     }
diff --git a/java/pom.xml b/java/pom.xml
index cf21d57..294258d 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -296,6 +296,7 @@
                 </module>
                 <module name="TreeWalker">
                   <module name="OuterTypeFilename"/>
+                  <module name="CommentsIndentation"/>
                   <module name="UnusedImports"/>
                   <module name="RedundantImport"/>
                   <!-- https://checkstyle.sourceforge.io/config_imports.html#ImportOrder IntelliJ default example -->