You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@parquet.apache.org by bl...@apache.org on 2016/01/12 23:45:40 UTC

parquet-mr git commit: PARQUET-422: Fix a potential bug in MessageTypeParser where we ignore…

Repository: parquet-mr
Updated Branches:
  refs/heads/master 84b2b7417 -> 30ee10d27


PARQUET-422: Fix a potential bug in MessageTypeParser where we ignore…

… and overwrite the initial value of a method parameter

In org.apache.parquet.schema.MessageTypeParser, for addGroupType() and addPrimitiveType(), the initial value of this parameter t is ignored, and t is overwritten here.

This often indicates a mistaken belief that the write to the parameter will be conveyed back to the caller.

This is a bug found by FindBugs™.

Author: proflin <pr...@gmail.com>

Closes #308 from proflin/PARQUET-422 and squashes the following commits:

df1f908 [proflin] PARQUET-422: Fix a potential bug in MessageTypeParser where we ignore and overwrite the initial value of a method parameter


Project: http://git-wip-us.apache.org/repos/asf/parquet-mr/repo
Commit: http://git-wip-us.apache.org/repos/asf/parquet-mr/commit/30ee10d2
Tree: http://git-wip-us.apache.org/repos/asf/parquet-mr/tree/30ee10d2
Diff: http://git-wip-us.apache.org/repos/asf/parquet-mr/diff/30ee10d2

Branch: refs/heads/master
Commit: 30ee10d2740fe1f28595989c6b21f22b75a147fc
Parents: 84b2b74
Author: proflin <pr...@gmail.com>
Authored: Tue Jan 12 14:45:24 2016 -0800
Committer: Ryan Blue <bl...@apache.org>
Committed: Tue Jan 12 14:45:24 2016 -0800

----------------------------------------------------------------------
 .../java/org/apache/parquet/schema/MessageTypeParser.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/30ee10d2/parquet-column/src/main/java/org/apache/parquet/schema/MessageTypeParser.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/org/apache/parquet/schema/MessageTypeParser.java b/parquet-column/src/main/java/org/apache/parquet/schema/MessageTypeParser.java
index 3603c79..4981398 100644
--- a/parquet-column/src/main/java/org/apache/parquet/schema/MessageTypeParser.java
+++ b/parquet-column/src/main/java/org/apache/parquet/schema/MessageTypeParser.java
@@ -106,14 +106,15 @@ public class MessageTypeParser {
     // Read type.
     String type = st.nextToken();
     if ("group".equalsIgnoreCase(type)) {
-      addGroupType(t, st, repetition, builder);
+      addGroupType(st, repetition, builder);
     } else {
-      addPrimitiveType(t, st, asPrimitive(type, st), repetition, builder);
+      addPrimitiveType(st, asPrimitive(type, st), repetition, builder);
     }
   }
 
-  private static void addGroupType(String t, Tokenizer st, Repetition r, GroupBuilder<?> builder) {
+  private static void addGroupType(Tokenizer st, Repetition r, GroupBuilder<?> builder) {
     GroupBuilder<?> childBuilder = builder.group(r);
+    String t;
     String name = st.nextToken();
 
     // Read annotation, if any.
@@ -138,8 +139,9 @@ public class MessageTypeParser {
     childBuilder.named(name);
   }
 
-  private static void addPrimitiveType(String t, Tokenizer st, PrimitiveTypeName type, Repetition r, Types.GroupBuilder<?> builder) {
+  private static void addPrimitiveType(Tokenizer st, PrimitiveTypeName type, Repetition r, Types.GroupBuilder<?> builder) {
     PrimitiveBuilder<?> childBuilder = builder.primitive(type, r);
+    String t;
 
     if (type == PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY) {
       t = st.nextToken();