parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject parquet-mr git commit: PARQUET-422: Fix a potential bug in MessageTypeParser where we ignore…
Date Tue, 12 Jan 2016 22:45:40 GMT
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 <proflin.me@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 <proflin.me@gmail.com>
Authored: Tue Jan 12 14:45:24 2016 -0800
Committer: Ryan Blue <blue@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();


Mime
View raw message