You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@orc.apache.org by GitBox <gi...@apache.org> on 2022/11/04 03:25:54 UTC

[GitHub] [orc] guiyanakuang opened a new pull request, #1305: ORC-1306: Fixed indented code style for Java modules

guiyanakuang opened a new pull request, #1305:
URL: https://github.com/apache/orc/pull/1305

   ### What changes were proposed in this pull request?
   This pr is aimed at fixing all indentation style issues with java modules. And add indentation checking rules to checkstyle.xml.
   
   ```xml
       <module name="Indentation">
         <property name="severity" value="error"/>
         <property name="basicOffset" value="2"/>
         <property name="braceAdjustment" value="0"/>
         <property name="caseIndent" value="2"/>
         <property name="throwsIndent" value="2"/>
         <property name="lineWrappingIndentation" value="4"/>
         <property name="arrayInitIndent" value="2"/>
       </module>
   ```
   
   ### Why are the changes needed?
   Automated checks save more time and nothing is missed.
   
   
   ### How was this patch tested?
   Checking with maven-check-plugin.
   


-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] guiyanakuang commented on pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
guiyanakuang commented on PR #1305:
URL: https://github.com/apache/orc/pull/1305#issuecomment-1306524313

   I have eliminated the redundant `{}`. Thank you for your careful review. : ) @dongjoon-hyun 


-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] guiyanakuang commented on a diff in pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
guiyanakuang commented on code in PR #1305:
URL: https://github.com/apache/orc/pull/1305#discussion_r1015075831


##########
java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java:
##########
@@ -118,62 +121,62 @@ protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
      * length for the string group which can be (STRING, CHAR, VARCHAR).
      */
     protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
-        int elementNum, TypeDescription readerType, byte[] bytes, int start, int length) {
+                                                int elementNum,
+                                                TypeDescription readerType,
+                                                byte[] bytes,
+                                                int start,
+                                                int length) {
       switch (readerType.getCategory()) {
-      case STRING:
-        bytesColVector.setVal(elementNum, bytes, start, length);
-        break;
-      case CHAR:
-        {
+        case STRING:
+          bytesColVector.setVal(elementNum, bytes, start, length);
+          break;
+        case CHAR: {
           int adjustedDownLen =
               StringExpr.rightTrimAndTruncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;
         }
-        break;
-      case VARCHAR:
-        {
+        case VARCHAR: {
           int adjustedDownLen =
               StringExpr.truncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;

Review Comment:
   Here I chose to move the break inside the brackets. Because if remove the {} . The context will show the problem of duplicate variables with the same name (`adjustedDownLen`) being defined.



-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] dongjoon-hyun commented on a diff in pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #1305:
URL: https://github.com/apache/orc/pull/1305#discussion_r1014989813


##########
java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java:
##########
@@ -118,62 +121,62 @@ protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
      * length for the string group which can be (STRING, CHAR, VARCHAR).
      */
     protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
-        int elementNum, TypeDescription readerType, byte[] bytes, int start, int length) {
+                                                int elementNum,
+                                                TypeDescription readerType,
+                                                byte[] bytes,
+                                                int start,
+                                                int length) {
       switch (readerType.getCategory()) {
-      case STRING:
-        bytesColVector.setVal(elementNum, bytes, start, length);
-        break;
-      case CHAR:
-        {
+        case STRING:
+          bytesColVector.setVal(elementNum, bytes, start, length);
+          break;
+        case CHAR: {
           int adjustedDownLen =
               StringExpr.rightTrimAndTruncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;
         }
-        break;
-      case VARCHAR:
-        {
+        case VARCHAR: {
           int adjustedDownLen =
               StringExpr.truncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;
         }
-        break;
-      default:
-        throw new RuntimeException("Unexpected type kind " + readerType.getCategory().name());
+        default:
+          throw new RuntimeException("Unexpected type kind " + readerType.getCategory().name());
       }
     }
 
     protected void convertStringGroupVectorElement(BytesColumnVector bytesColVector,
-        int elementNum, TypeDescription readerType) {
+                                                   int elementNum, TypeDescription readerType) {
       switch (readerType.getCategory()) {
-      case STRING:
-        // No conversion needed.
-        break;
-      case CHAR:
-        {
+        case STRING:
+          // No conversion needed.
+          break;
+        case CHAR: {
           int length = bytesColVector.length[elementNum];
           int adjustedDownLen = StringExpr
-            .rightTrimAndTruncate(bytesColVector.vector[elementNum],
-                bytesColVector.start[elementNum], length,
-                readerType.getMaxLength());
+              .rightTrimAndTruncate(bytesColVector.vector[elementNum],
+                  bytesColVector.start[elementNum], length,
+                  readerType.getMaxLength());
           if (adjustedDownLen < length) {
             bytesColVector.length[elementNum] = adjustedDownLen;
           }
+          break;

Review Comment:
   ditto.



-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] guiyanakuang commented on pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
guiyanakuang commented on PR #1305:
URL: https://github.com/apache/orc/pull/1305#issuecomment-1304371094

   cc @dongjoon-hyun @williamhyun.
   Btw, there are very few conflicts with the port patch. Therefore it does not cause additional work for further ports.


-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] guiyanakuang commented on pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
guiyanakuang commented on PR #1305:
URL: https://github.com/apache/orc/pull/1305#issuecomment-1304725995

   This is really weird, let me fix it. Also the master branch has been merged, so I'll fix it after this pr review is over.


-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] guiyanakuang commented on a diff in pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
guiyanakuang commented on code in PR #1305:
URL: https://github.com/apache/orc/pull/1305#discussion_r1015075831


##########
java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java:
##########
@@ -118,62 +121,62 @@ protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
      * length for the string group which can be (STRING, CHAR, VARCHAR).
      */
     protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
-        int elementNum, TypeDescription readerType, byte[] bytes, int start, int length) {
+                                                int elementNum,
+                                                TypeDescription readerType,
+                                                byte[] bytes,
+                                                int start,
+                                                int length) {
       switch (readerType.getCategory()) {
-      case STRING:
-        bytesColVector.setVal(elementNum, bytes, start, length);
-        break;
-      case CHAR:
-        {
+        case STRING:
+          bytesColVector.setVal(elementNum, bytes, start, length);
+          break;
+        case CHAR: {
           int adjustedDownLen =
               StringExpr.rightTrimAndTruncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;
         }
-        break;
-      case VARCHAR:
-        {
+        case VARCHAR: {
           int adjustedDownLen =
               StringExpr.truncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;

Review Comment:
   Here I chose to move the break inside the brackets. Because if remove the {} . The context will show the problem of duplicate variables with the same name (`adjustedDownLen`) being defined.



-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] dongjoon-hyun closed pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun closed pull request #1305: ORC-1306: Fixed indented code style for Java modules
URL: https://github.com/apache/orc/pull/1305


-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] dongjoon-hyun commented on a diff in pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #1305:
URL: https://github.com/apache/orc/pull/1305#discussion_r1014989716


##########
java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java:
##########
@@ -118,62 +121,62 @@ protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
      * length for the string group which can be (STRING, CHAR, VARCHAR).
      */
     protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
-        int elementNum, TypeDescription readerType, byte[] bytes, int start, int length) {
+                                                int elementNum,
+                                                TypeDescription readerType,
+                                                byte[] bytes,
+                                                int start,
+                                                int length) {
       switch (readerType.getCategory()) {
-      case STRING:
-        bytesColVector.setVal(elementNum, bytes, start, length);
-        break;
-      case CHAR:
-        {
+        case STRING:
+          bytesColVector.setVal(elementNum, bytes, start, length);
+          break;
+        case CHAR: {
           int adjustedDownLen =
               StringExpr.rightTrimAndTruncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;
         }
-        break;

Review Comment:
   If you don't mind, please rename `adjustedDownLen` and remove `{}`.



##########
java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java:
##########
@@ -118,62 +121,62 @@ protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
      * length for the string group which can be (STRING, CHAR, VARCHAR).
      */
     protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
-        int elementNum, TypeDescription readerType, byte[] bytes, int start, int length) {
+                                                int elementNum,
+                                                TypeDescription readerType,
+                                                byte[] bytes,
+                                                int start,
+                                                int length) {
       switch (readerType.getCategory()) {
-      case STRING:
-        bytesColVector.setVal(elementNum, bytes, start, length);
-        break;
-      case CHAR:
-        {
+        case STRING:
+          bytesColVector.setVal(elementNum, bytes, start, length);
+          break;
+        case CHAR: {
           int adjustedDownLen =
               StringExpr.rightTrimAndTruncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;
         }
-        break;
-      case VARCHAR:
-        {
+        case VARCHAR: {
           int adjustedDownLen =
               StringExpr.truncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;

Review Comment:
   ditto.



-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] dongjoon-hyun commented on pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on PR #1305:
URL: https://github.com/apache/orc/pull/1305#issuecomment-1309071884

   Merged to branch-1.8.


-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] dongjoon-hyun commented on pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on PR #1305:
URL: https://github.com/apache/orc/pull/1305#issuecomment-1304722250

   Thank you for making a backport, @guiyanakuang . There exist a few case where `break` is indented in the same level with the next `case` statement in this PR. It looks weird to me. I guess we can fix them by eliminating the redundant `{}`.
   ```
   break;
   case ...
   ```


-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] guiyanakuang commented on a diff in pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
guiyanakuang commented on code in PR #1305:
URL: https://github.com/apache/orc/pull/1305#discussion_r1014777920


##########
java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java:
##########
@@ -118,62 +121,62 @@ protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
      * length for the string group which can be (STRING, CHAR, VARCHAR).
      */
     protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
-        int elementNum, TypeDescription readerType, byte[] bytes, int start, int length) {
+                                                int elementNum,
+                                                TypeDescription readerType,
+                                                byte[] bytes,
+                                                int start,
+                                                int length) {
       switch (readerType.getCategory()) {
-      case STRING:
-        bytesColVector.setVal(elementNum, bytes, start, length);
-        break;
-      case CHAR:
-        {
+        case STRING:
+          bytesColVector.setVal(elementNum, bytes, start, length);
+          break;
+        case CHAR: {
           int adjustedDownLen =
               StringExpr.rightTrimAndTruncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;
         }
-        break;

Review Comment:
   @dongjoon-hyun. Here I chose to move the break inside the brackets. Because if remove the {} . The context will show the problem of duplicate variables with the same name (`adjustedDownLen `) being defined. 



-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] dongjoon-hyun commented on a diff in pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #1305:
URL: https://github.com/apache/orc/pull/1305#discussion_r1014989872


##########
java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java:
##########
@@ -118,62 +121,62 @@ protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
      * length for the string group which can be (STRING, CHAR, VARCHAR).
      */
     protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
-        int elementNum, TypeDescription readerType, byte[] bytes, int start, int length) {
+                                                int elementNum,
+                                                TypeDescription readerType,
+                                                byte[] bytes,
+                                                int start,
+                                                int length) {
       switch (readerType.getCategory()) {
-      case STRING:
-        bytesColVector.setVal(elementNum, bytes, start, length);
-        break;
-      case CHAR:
-        {
+        case STRING:
+          bytesColVector.setVal(elementNum, bytes, start, length);
+          break;
+        case CHAR: {
           int adjustedDownLen =
               StringExpr.rightTrimAndTruncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;
         }
-        break;
-      case VARCHAR:
-        {
+        case VARCHAR: {
           int adjustedDownLen =
               StringExpr.truncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;
         }
-        break;
-      default:
-        throw new RuntimeException("Unexpected type kind " + readerType.getCategory().name());
+        default:
+          throw new RuntimeException("Unexpected type kind " + readerType.getCategory().name());
       }
     }
 
     protected void convertStringGroupVectorElement(BytesColumnVector bytesColVector,
-        int elementNum, TypeDescription readerType) {
+                                                   int elementNum, TypeDescription readerType) {
       switch (readerType.getCategory()) {
-      case STRING:
-        // No conversion needed.
-        break;
-      case CHAR:
-        {
+        case STRING:
+          // No conversion needed.
+          break;
+        case CHAR: {
           int length = bytesColVector.length[elementNum];
           int adjustedDownLen = StringExpr
-            .rightTrimAndTruncate(bytesColVector.vector[elementNum],
-                bytesColVector.start[elementNum], length,
-                readerType.getMaxLength());
+              .rightTrimAndTruncate(bytesColVector.vector[elementNum],
+                  bytesColVector.start[elementNum], length,
+                  readerType.getMaxLength());
           if (adjustedDownLen < length) {
             bytesColVector.length[elementNum] = adjustedDownLen;
           }
+          break;
         }
-        break;
-      case VARCHAR:
-        {
+        case VARCHAR: {
           int length = bytesColVector.length[elementNum];
           int adjustedDownLen = StringExpr
-            .truncate(bytesColVector.vector[elementNum],
-                bytesColVector.start[elementNum], length,
-                readerType.getMaxLength());
+              .truncate(bytesColVector.vector[elementNum],
+                  bytesColVector.start[elementNum], length,
+                  readerType.getMaxLength());
           if (adjustedDownLen < length) {
             bytesColVector.length[elementNum] = adjustedDownLen;
           }
+          break;

Review Comment:
   ditto



-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] guiyanakuang commented on a diff in pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
guiyanakuang commented on code in PR #1305:
URL: https://github.com/apache/orc/pull/1305#discussion_r1015092470


##########
java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java:
##########
@@ -118,62 +121,62 @@ protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
      * length for the string group which can be (STRING, CHAR, VARCHAR).
      */
     protected void assignStringGroupVectorEntry(BytesColumnVector bytesColVector,
-        int elementNum, TypeDescription readerType, byte[] bytes, int start, int length) {
+                                                int elementNum,
+                                                TypeDescription readerType,
+                                                byte[] bytes,
+                                                int start,
+                                                int length) {
       switch (readerType.getCategory()) {
-      case STRING:
-        bytesColVector.setVal(elementNum, bytes, start, length);
-        break;
-      case CHAR:
-        {
+        case STRING:
+          bytesColVector.setVal(elementNum, bytes, start, length);
+          break;
+        case CHAR: {
           int adjustedDownLen =
               StringExpr.rightTrimAndTruncate(bytes, start, length, readerType.getMaxLength());
           bytesColVector.setVal(elementNum, bytes, start, adjustedDownLen);
+          break;
         }
-        break;

Review Comment:
   OK, following your advice.



-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] dongjoon-hyun commented on a diff in pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #1305:
URL: https://github.com/apache/orc/pull/1305#discussion_r1014771172


##########
java/core/src/java/org/apache/orc/OrcUtils.java:
##########
@@ -345,27 +344,27 @@ TypeDescription convertTypeFromProtobuf(List<OrcProto.Type> types,
             convertTypeFromProtobuf(types, type.getSubtypes(1)));
         break;
       case STRUCT: {
-          result = TypeDescription.createStruct();
-          for(int f=0; f < type.getSubtypesCount(); ++f) {
-            String name = type.getFieldNames(f);
-            name = name.startsWith("`") ? name : "`" + name + "`";
-            String fieldName = ParserUtils.parseName(new ParserUtils.StringPosition(name));
-            result.addField(fieldName, convertTypeFromProtobuf(types, type.getSubtypes(f)));
-          }
+        result = TypeDescription.createStruct();
+        for(int f=0; f < type.getSubtypesCount(); ++f) {
+          String name = type.getFieldNames(f);
+          name = name.startsWith("`") ? name : "`" + name + "`";
+          String fieldName = ParserUtils.parseName(new ParserUtils.StringPosition(name));
+          result.addField(fieldName, convertTypeFromProtobuf(types, type.getSubtypes(f)));
         }
-        break;
+      }
+      break;
       case UNION: {

Review Comment:
   ditto. 
   ```
   - case UNION: {
   + case UNION:
   ```



##########
java/core/src/java/org/apache/orc/OrcUtils.java:
##########
@@ -318,15 +317,15 @@ TypeDescription convertTypeFromProtobuf(List<OrcProto.Type> types,
         result = TypeDescription.createDate();
         break;
       case DECIMAL: {
-          result = TypeDescription.createDecimal();
-          if (type.hasScale()) {
-            result.withScale(type.getScale());
-          }
-          if (type.hasPrecision()) {
-            result.withPrecision(type.getPrecision());
-          }
+        result = TypeDescription.createDecimal();
+        if (type.hasScale()) {
+          result.withScale(type.getScale());
         }
-        break;
+        if (type.hasPrecision()) {
+          result.withPrecision(type.getPrecision());
+        }
+      }
+      break;

Review Comment:
   It seems that I missed this in `main` branch but `break` indentation looks weird to me. Shall we remove the extra `{}` instead?
   ```
   - case DECIMAL: {
   + case DECIMAL:
   ```
   - Do you think newly added indentation rule looks insufficient to catch this?



##########
java/core/src/java/org/apache/orc/OrcUtils.java:
##########
@@ -345,27 +344,27 @@ TypeDescription convertTypeFromProtobuf(List<OrcProto.Type> types,
             convertTypeFromProtobuf(types, type.getSubtypes(1)));
         break;
       case STRUCT: {
-          result = TypeDescription.createStruct();
-          for(int f=0; f < type.getSubtypesCount(); ++f) {
-            String name = type.getFieldNames(f);
-            name = name.startsWith("`") ? name : "`" + name + "`";
-            String fieldName = ParserUtils.parseName(new ParserUtils.StringPosition(name));
-            result.addField(fieldName, convertTypeFromProtobuf(types, type.getSubtypes(f)));
-          }
+        result = TypeDescription.createStruct();
+        for(int f=0; f < type.getSubtypesCount(); ++f) {
+          String name = type.getFieldNames(f);
+          name = name.startsWith("`") ? name : "`" + name + "`";
+          String fieldName = ParserUtils.parseName(new ParserUtils.StringPosition(name));
+          result.addField(fieldName, convertTypeFromProtobuf(types, type.getSubtypes(f)));
         }
-        break;
+      }
+      break;

Review Comment:
   ditto.
   ```
   - case STRUCT: {
   + case STRUCT:
   ```



-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [orc] guiyanakuang commented on a diff in pull request #1305: ORC-1306: Fixed indented code style for Java modules

Posted by GitBox <gi...@apache.org>.
guiyanakuang commented on code in PR #1305:
URL: https://github.com/apache/orc/pull/1305#discussion_r1014778205


##########
java/core/src/java/org/apache/orc/OrcUtils.java:
##########
@@ -318,15 +317,15 @@ TypeDescription convertTypeFromProtobuf(List<OrcProto.Type> types,
         result = TypeDescription.createDate();
         break;
       case DECIMAL: {
-          result = TypeDescription.createDecimal();
-          if (type.hasScale()) {
-            result.withScale(type.getScale());
-          }
-          if (type.hasPrecision()) {
-            result.withPrecision(type.getPrecision());
-          }
+        result = TypeDescription.createDecimal();
+        if (type.hasScale()) {
+          result.withScale(type.getScale());
         }
-        break;
+        if (type.hasPrecision()) {
+          result.withPrecision(type.getPrecision());
+        }
+      }
+      break;

Review Comment:
   When {} is present, the new rule expects the break indent to be the same as the case, 6 spaces.
   I have now removed the {}.



-- 
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@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org