parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [20/51] [partial] parquet-mr git commit: PARQUET-23: Rename to org.apache.parquet.
Date Mon, 27 Apr 2015 23:12:17 GMT
http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/test/java/parquet/schema/TestTypeBuilders.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/test/java/parquet/schema/TestTypeBuilders.java b/parquet-column/src/test/java/parquet/schema/TestTypeBuilders.java
deleted file mode 100644
index fdc7bf0..0000000
--- a/parquet-column/src/test/java/parquet/schema/TestTypeBuilders.java
+++ /dev/null
@@ -1,619 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package parquet.schema;
-
-import java.util.concurrent.Callable;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-import parquet.schema.PrimitiveType.PrimitiveTypeName;
-
-import static parquet.schema.OriginalType.*;
-import static parquet.schema.PrimitiveType.PrimitiveTypeName.*;
-import static parquet.schema.Type.Repetition.*;
-
-public class TestTypeBuilders {
-  @Test
-  public void testPaperExample() {
-    MessageType expected =
-        new MessageType("Document",
-            new PrimitiveType(REQUIRED, INT64, "DocId"),
-            new GroupType(OPTIONAL, "Links",
-                new PrimitiveType(REPEATED, INT64, "Backward"),
-                new PrimitiveType(REPEATED, INT64, "Forward")),
-            new GroupType(REPEATED, "Name",
-                new GroupType(REPEATED, "Language",
-                    new PrimitiveType(REQUIRED, BINARY, "Code"),
-                    new PrimitiveType(REQUIRED, BINARY, "Country")),
-                new PrimitiveType(OPTIONAL, BINARY, "Url")));
-    MessageType builderType = Types.buildMessage()
-        .required(INT64).named("DocId")
-        .optionalGroup()
-            .repeated(INT64).named("Backward")
-            .repeated(INT64).named("Forward")
-            .named("Links")
-        .repeatedGroup()
-            .repeatedGroup()
-                .required(BINARY).named("Code")
-                .required(BINARY).named("Country")
-            .named("Language")
-            .optional(BINARY).named("Url")
-            .named("Name")
-        .named("Document");
-    Assert.assertEquals(expected, builderType);
-  }
-
-  @Test
-  public void testGroupTypeConstruction() {
-    PrimitiveType f1 = Types.required(BINARY).as(UTF8).named("f1");
-    PrimitiveType f2 = Types.required(INT32).named("f2");
-    PrimitiveType f3 = Types.optional(INT32).named("f3");
-    String name = "group";
-    for (Type.Repetition repetition : Type.Repetition.values()) {
-      GroupType expected = new GroupType(repetition, name,
-          f1,
-          new GroupType(repetition, "g1", f2, f3));
-      GroupType built = Types.buildGroup(repetition)
-          .addField(f1)
-          .group(repetition).addFields(f2, f3).named("g1")
-          .named(name);
-      Assert.assertEquals(expected, built);
-
-      switch (repetition) {
-        case REQUIRED:
-          built = Types.requiredGroup()
-              .addField(f1)
-              .requiredGroup().addFields(f2, f3).named("g1")
-              .named(name);
-          break;
-        case OPTIONAL:
-          built = Types.optionalGroup()
-              .addField(f1)
-              .optionalGroup().addFields(f2, f3).named("g1")
-              .named(name);
-          break;
-        case REPEATED:
-          built = Types.repeatedGroup()
-              .addField(f1)
-              .repeatedGroup().addFields(f2, f3).named("g1")
-              .named(name);
-          break;
-      }
-      Assert.assertEquals(expected, built);
-    }
-  }
-
-  @Test
-  public void testPrimitiveTypeConstruction() {
-    PrimitiveTypeName[] types = new PrimitiveTypeName[] {
-        BOOLEAN, INT32, INT64, INT96, FLOAT, DOUBLE, BINARY
-    };
-    for (PrimitiveTypeName type : types) {
-      String name = type.toString() + "_";
-      for (Type.Repetition repetition : Type.Repetition.values()) {
-        PrimitiveType expected = new PrimitiveType(repetition, type, name);
-        PrimitiveType built = Types.primitive(type, repetition).named(name);
-        Assert.assertEquals(expected, built);
-        switch (repetition) {
-          case REQUIRED:
-            built = Types.required(type).named(name);
-            break;
-          case OPTIONAL:
-            built = Types.optional(type).named(name);
-            break;
-          case REPEATED:
-            built = Types.repeated(type).named(name);
-            break;
-        }
-        Assert.assertEquals(expected, built);
-      }
-    }
-  }
-
-  @Test
-  public void testFixedTypeConstruction() {
-    String name = "fixed_";
-    int len = 5;
-    for (Type.Repetition repetition : Type.Repetition.values()) {
-      PrimitiveType expected = new PrimitiveType(
-          repetition, FIXED_LEN_BYTE_ARRAY, len, name);
-      PrimitiveType built = Types.primitive(FIXED_LEN_BYTE_ARRAY, repetition)
-          .length(len).named(name);
-      Assert.assertEquals(expected, built);
-      switch (repetition) {
-        case REQUIRED:
-          built = Types.required(FIXED_LEN_BYTE_ARRAY).length(len).named(name);
-          break;
-        case OPTIONAL:
-          built = Types.optional(FIXED_LEN_BYTE_ARRAY).length(len).named(name);
-          break;
-        case REPEATED:
-          built = Types.repeated(FIXED_LEN_BYTE_ARRAY).length(len).named(name);
-          break;
-      }
-      Assert.assertEquals(expected, built);
-    }
-  }
-
-  @Test
-  public void testEmptyGroup() {
-    assertThrows("Should complain that required group is empty",
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.requiredGroup().named("g");
-          }
-        });
-    assertThrows("Should complain that optional group is empty",
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.optionalGroup().named("g");
-          }
-        });
-    assertThrows("Should complain that repeated group is empty",
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.repeatedGroup().named("g");
-          }
-        });
-  }
-
-  @Test
-  @Ignore(value="Enforcing this breaks tests in parquet-thrift")
-  public void testEmptyMessage() {
-    assertThrows("Should complain that message is empty",
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage().named("m");
-          }
-        });
-  }
-
-  @Test(expected=IllegalArgumentException.class)
-  public void testFixedWithoutLength() {
-    Types.required(FIXED_LEN_BYTE_ARRAY).named("fixed");
-  }
-
-  @Test
-  public void testFixedWithLength() {
-    PrimitiveType expected = new PrimitiveType(REQUIRED, FIXED_LEN_BYTE_ARRAY, 7, "fixed");
-    PrimitiveType fixed = Types.required(FIXED_LEN_BYTE_ARRAY).length(7).named("fixed");
-    Assert.assertEquals(expected, fixed);
-  }
-
-  @Test
-  public void testFixedLengthEquals() {
-    Type f4 = Types.required(FIXED_LEN_BYTE_ARRAY).length(4).named("f4");
-    Type f8 = Types.required(FIXED_LEN_BYTE_ARRAY).length(8).named("f8");
-    Assert.assertFalse("Types with different lengths should not be equal",
-        f4.equals(f8));
-  }
-
-  @Test
-  public void testDecimalAnnotation() {
-    // int32 primitive type
-    MessageType expected = new MessageType("DecimalMessage",
-        new PrimitiveType(REQUIRED, INT32, 0, "aDecimal",
-            DECIMAL, new DecimalMetadata(9, 2), null));
-    MessageType builderType = Types.buildMessage()
-        .required(INT32)
-            .as(DECIMAL).precision(9).scale(2)
-            .named("aDecimal")
-        .named("DecimalMessage");
-    Assert.assertEquals(expected, builderType);
-    // int64 primitive type
-    expected = new MessageType("DecimalMessage",
-        new PrimitiveType(REQUIRED, INT64, 0, "aDecimal",
-            DECIMAL, new DecimalMetadata(18, 2), null));
-    builderType = Types.buildMessage()
-        .required(INT64)
-            .as(DECIMAL).precision(18).scale(2)
-            .named("aDecimal")
-        .named("DecimalMessage");
-    Assert.assertEquals(expected, builderType);
-    // binary primitive type
-    expected = new MessageType("DecimalMessage",
-        new PrimitiveType(REQUIRED, BINARY, 0, "aDecimal",
-            DECIMAL, new DecimalMetadata(9, 2), null));
-    builderType = Types.buildMessage()
-        .required(BINARY).as(DECIMAL).precision(9).scale(2)
-            .named("aDecimal")
-        .named("DecimalMessage");
-    Assert.assertEquals(expected, builderType);
-    // fixed primitive type
-    expected = new MessageType("DecimalMessage",
-        new PrimitiveType(REQUIRED, FIXED_LEN_BYTE_ARRAY, 4, "aDecimal",
-            DECIMAL, new DecimalMetadata(9, 2), null));
-    builderType = Types.buildMessage()
-        .required(FIXED_LEN_BYTE_ARRAY).length(4)
-            .as(DECIMAL).precision(9).scale(2)
-            .named("aDecimal")
-        .named("DecimalMessage");
-    Assert.assertEquals(expected, builderType);
-  }
-
-  @Test
-  public void testDecimalAnnotationMissingScale() {
-    MessageType expected = new MessageType("DecimalMessage",
-        new PrimitiveType(REQUIRED, INT32, 0, "aDecimal",
-            DECIMAL, new DecimalMetadata(9, 0), null));
-    MessageType builderType = Types.buildMessage()
-        .required(INT32)
-            .as(DECIMAL).precision(9)
-            .named("aDecimal")
-        .named("DecimalMessage");
-    Assert.assertEquals(expected, builderType);
-
-    expected = new MessageType("DecimalMessage",
-        new PrimitiveType(REQUIRED, INT64, 0, "aDecimal",
-            DECIMAL, new DecimalMetadata(9, 0), null));
-    builderType = Types.buildMessage()
-        .required(INT64)
-            .as(DECIMAL).precision(9)
-            .named("aDecimal")
-        .named("DecimalMessage");
-    Assert.assertEquals(expected, builderType);
-
-    expected = new MessageType("DecimalMessage",
-        new PrimitiveType(REQUIRED, BINARY, 0, "aDecimal",
-            DECIMAL, new DecimalMetadata(9, 0), null));
-    builderType = Types.buildMessage()
-        .required(BINARY).as(DECIMAL).precision(9)
-            .named("aDecimal")
-        .named("DecimalMessage");
-    Assert.assertEquals(expected, builderType);
-
-    expected = new MessageType("DecimalMessage",
-        new PrimitiveType(REQUIRED, FIXED_LEN_BYTE_ARRAY, 7, "aDecimal",
-            DECIMAL, new DecimalMetadata(9, 0), null));
-    builderType = Types.buildMessage()
-        .required(FIXED_LEN_BYTE_ARRAY).length(7)
-            .as(DECIMAL).precision(9)
-            .named("aDecimal")
-        .named("DecimalMessage");
-    Assert.assertEquals(expected, builderType);
-  }
-
-  @Test
-  public void testDecimalAnnotationMissingPrecision() {
-    assertThrows("Should reject decimal annotation without precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(INT32).as(DECIMAL).scale(2)
-                    .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        });
-    assertThrows("Should reject decimal annotation without precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(INT64).as(DECIMAL).scale(2)
-                    .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        });
-    assertThrows("Should reject decimal annotation without precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(BINARY).as(DECIMAL).scale(2)
-                    .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        });
-    assertThrows("Should reject decimal annotation without precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(FIXED_LEN_BYTE_ARRAY).length(7)
-                .as(DECIMAL).scale(2)
-                .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        }
-    );
-  }
-
-  @Test
-  public void testDecimalAnnotationPrecisionScaleBound() {
-    assertThrows("Should reject scale greater than precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(INT32).as(DECIMAL).precision(3).scale(4)
-                    .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        });
-    assertThrows("Should reject scale greater than precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(INT64).as(DECIMAL).precision(3).scale(4)
-                    .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        });
-    assertThrows("Should reject scale greater than precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(BINARY).as(DECIMAL).precision(3).scale(4)
-                    .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        });
-    assertThrows("Should reject scale greater than precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(FIXED_LEN_BYTE_ARRAY).length(7)
-                .as(DECIMAL).precision(3).scale(4)
-                .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        }
-    );
-  }
-
-  @Test
-  public void testDecimalAnnotationLengthCheck() {
-    // maximum precision for 4 bytes is 9
-    assertThrows("should reject precision 10 with length 4",
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.required(FIXED_LEN_BYTE_ARRAY).length(4)
-                .as(DECIMAL).precision(10).scale(2)
-                .named("aDecimal");
-          }
-        });
-    assertThrows("should reject precision 10 with length 4",
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.required(INT32)
-                .as(DECIMAL).precision(10).scale(2)
-                .named("aDecimal");
-          }
-        });
-    // maximum precision for 8 bytes is 19
-    assertThrows("should reject precision 19 with length 8",
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.required(FIXED_LEN_BYTE_ARRAY).length(8)
-                .as(DECIMAL).precision(19).scale(4)
-                .named("aDecimal");
-          }
-        });
-    assertThrows("should reject precision 19 with length 8",
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.required(INT64).length(8)
-                .as(DECIMAL).precision(19).scale(4)
-                .named("aDecimal");
-          }
-        }
-    );
-  }
-
-  @Test
-  public void testDECIMALAnnotationRejectsUnsupportedTypes() {
-    PrimitiveTypeName[] unsupported = new PrimitiveTypeName[]{
-        BOOLEAN, INT96, DOUBLE, FLOAT
-    };
-    for (final PrimitiveTypeName type : unsupported) {
-      assertThrows("Should reject non-binary type: " + type,
-          IllegalStateException.class, new Callable<Type>() {
-            @Override
-            public Type call() throws Exception {
-              return Types.required(type)
-                  .as(DECIMAL).precision(9).scale(2)
-                  .named("d");
-            }
-          });
-    }
-  }
-
-  @Test
-  public void testBinaryAnnotations() {
-    OriginalType[] types = new OriginalType[] {
-        UTF8, JSON, BSON};
-    for (final OriginalType logicalType : types) {
-      PrimitiveType expected = new PrimitiveType(REQUIRED, BINARY, "col", logicalType);
-      PrimitiveType string = Types.required(BINARY).as(logicalType).named("col");
-      Assert.assertEquals(expected, string);
-    }
-  }
-
-  @Test
-  public void testBinaryAnnotationsRejectsNonBinary() {
-    OriginalType[] types = new OriginalType[] {
-        UTF8, JSON, BSON};
-    for (final OriginalType logicalType : types) {
-      PrimitiveTypeName[] nonBinary = new PrimitiveTypeName[]{
-          BOOLEAN, INT32, INT64, INT96, DOUBLE, FLOAT
-      };
-      for (final PrimitiveTypeName type : nonBinary) {
-        assertThrows("Should reject non-binary type: " + type,
-            IllegalStateException.class, new Callable<Type>() {
-              @Override
-              public Type call() throws Exception {
-                return Types.required(type).as(logicalType).named("col");
-              }
-            });
-      }
-      assertThrows("Should reject non-binary type: FIXED_LEN_BYTE_ARRAY",
-          IllegalStateException.class, new Callable<Type>() {
-            @Override
-            public Type call() throws Exception {
-              return Types.required(FIXED_LEN_BYTE_ARRAY).length(1)
-                  .as(logicalType).named("col");
-            }
-          });
-    }
-  }
-
-  @Test
-  public void testInt32Annotations() {
-    OriginalType[] types = new OriginalType[] {
-        DATE, TIME_MILLIS, UINT_8, UINT_16, UINT_32, INT_8, INT_16, INT_32};
-    for (OriginalType logicalType : types) {
-      PrimitiveType expected = new PrimitiveType(REQUIRED, INT32, "col", logicalType);
-      PrimitiveType date = Types.required(INT32).as(logicalType).named("col");
-      Assert.assertEquals(expected, date);
-    }
-  }
-
-  @Test
-  public void testInt32AnnotationsRejectNonInt32() {
-    OriginalType[] types = new OriginalType[] {
-        DATE, TIME_MILLIS, UINT_8, UINT_16, UINT_32, INT_8, INT_16, INT_32};
-    for (final OriginalType logicalType : types) {
-      PrimitiveTypeName[] nonInt32 = new PrimitiveTypeName[]{
-          BOOLEAN, INT64, INT96, DOUBLE, FLOAT, BINARY
-      };
-      for (final PrimitiveTypeName type : nonInt32) {
-        assertThrows("Should reject non-int32 type: " + type,
-            IllegalStateException.class, new Callable<Type>() {
-              @Override
-              public Type call() throws Exception {
-                return Types.required(type).as(logicalType).named("col");
-              }
-            });
-      }
-      assertThrows("Should reject non-int32 type: FIXED_LEN_BYTE_ARRAY",
-          IllegalStateException.class, new Callable<Type>() {
-            @Override
-            public Type call() throws Exception {
-              return Types.required(FIXED_LEN_BYTE_ARRAY).length(1)
-                  .as(logicalType).named("col");
-            }
-          });
-    }
-  }
-
-  @Test
-  public void testInt64Annotations() {
-    OriginalType[] types = new OriginalType[] {
-        TIMESTAMP_MILLIS, UINT_64, INT_64};
-    for (OriginalType logicalType : types) {
-      PrimitiveType expected = new PrimitiveType(REQUIRED, INT64, "col", logicalType);
-      PrimitiveType date = Types.required(INT64).as(logicalType).named("col");
-      Assert.assertEquals(expected, date);
-    }
-  }
-
-  @Test
-  public void testInt64AnnotationsRejectNonInt64() {
-    OriginalType[] types = new OriginalType[] {
-        TIMESTAMP_MILLIS, UINT_64, INT_64};
-    for (final OriginalType logicalType : types) {
-      PrimitiveTypeName[] nonInt64 = new PrimitiveTypeName[]{
-          BOOLEAN, INT32, INT96, DOUBLE, FLOAT, BINARY
-      };
-      for (final PrimitiveTypeName type : nonInt64) {
-        assertThrows("Should reject non-int64 type: " + type,
-            IllegalStateException.class, new Callable<Type>() {
-              @Override
-              public Type call() throws Exception {
-                return Types.required(type).as(logicalType).named("col");
-              }
-            });
-      }
-      assertThrows("Should reject non-int64 type: FIXED_LEN_BYTE_ARRAY",
-          IllegalStateException.class, new Callable<Type>() {
-            @Override
-            public Type call() throws Exception {
-              return Types.required(FIXED_LEN_BYTE_ARRAY).length(1)
-                  .as(logicalType).named("col");
-            }
-          });
-    }
-  }
-
-  @Test
-  public void testIntervalAnnotation() {
-    PrimitiveType expected = new PrimitiveType(REQUIRED, FIXED_LEN_BYTE_ARRAY, 12, "interval", INTERVAL);
-    PrimitiveType string = Types.required(FIXED_LEN_BYTE_ARRAY).length(12)
-        .as(INTERVAL).named("interval");
-    Assert.assertEquals(expected, string);
-  }
-
-  @Test
-  public void testIntervalAnnotationRejectsNonFixed() {
-    PrimitiveTypeName[] nonFixed = new PrimitiveTypeName[]{
-        BOOLEAN, INT32, INT64, INT96, DOUBLE, FLOAT, BINARY
-    };
-    for (final PrimitiveTypeName type : nonFixed) {
-      assertThrows("Should reject non-fixed type: " + type,
-          IllegalStateException.class, new Callable<Type>() {
-            @Override
-            public Type call() throws Exception {
-              return Types.required(type).as(INTERVAL).named("interval");
-            }
-          });
-    }
-  }
-
-  @Test
-  public void testIntervalAnnotationRejectsNonFixed12() {
-    assertThrows("Should reject fixed with length != 12: " + 11,
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.required(FIXED_LEN_BYTE_ARRAY).length(11)
-                .as(INTERVAL).named("interval");
-          }
-        });
-  }
-
-
-  /**
-   * A convenience method to avoid a large number of @Test(expected=...) tests
-   * @param message A String message to describe this assertion
-   * @param expected An Exception class that the Runnable should throw
-   * @param callable A Callable that is expected to throw the exception
-   */
-  public static void assertThrows(
-      String message, Class<? extends Exception> expected, Callable callable) {
-    try {
-      callable.call();
-      Assert.fail("No exception was thrown (" + message + "), expected: " +
-          expected.getName());
-    } catch (Exception actual) {
-      Assert.assertEquals(message, expected, actual.getClass());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/pom.xml
----------------------------------------------------------------------
diff --git a/parquet-common/pom.xml b/parquet-common/pom.xml
index 613467f..cbc3ae6 100644
--- a/parquet-common/pom.xml
+++ b/parquet-common/pom.xml
@@ -18,7 +18,7 @@
   -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <parent>
-    <groupId>com.twitter</groupId>
+    <groupId>org.apache.parquet</groupId>
     <artifactId>parquet</artifactId>
     <relativePath>../pom.xml</relativePath>
     <version>1.7.0-incubating-SNAPSHOT</version>

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/org/apache/parquet/Closeables.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/org/apache/parquet/Closeables.java b/parquet-common/src/main/java/org/apache/parquet/Closeables.java
new file mode 100644
index 0000000..2d8bb77
--- /dev/null
+++ b/parquet-common/src/main/java/org/apache/parquet/Closeables.java
@@ -0,0 +1,55 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * Utility for working with {@link java.io.Closeable}ss
+ */
+public final class Closeables {
+  private Closeables() { }
+
+  private static final Log LOG = Log.getLog(Closeables.class);
+
+  /**
+   * Closes a (potentially null) closeable.
+   * @param c can be null
+   * @throws IOException if c.close() throws an IOException.
+   */
+  public static void close(Closeable c) throws IOException {
+    if (c == null) { return; }
+    c.close();
+  }
+
+  /**
+   * Closes a (potentially null) closeable, swallowing any IOExceptions thrown by
+   * c.close(). The exception will be logged.
+   * @param c can be null
+   */
+  public static void closeAndSwallowIOExceptions(Closeable c) {
+    if (c == null) { return; }
+    try {
+      c.close();
+    } catch (IOException e) {
+      LOG.warn("Encountered exception closing closeable", e);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/org/apache/parquet/Ints.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/org/apache/parquet/Ints.java b/parquet-common/src/main/java/org/apache/parquet/Ints.java
new file mode 100644
index 0000000..b195966
--- /dev/null
+++ b/parquet-common/src/main/java/org/apache/parquet/Ints.java
@@ -0,0 +1,44 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet;
+
+/**
+ * Utilities for working with ints
+ *
+ * @author Alex Levenson
+ */
+public final class Ints {
+  private Ints() { }
+
+  /**
+   * Cast value to a an int, or throw an exception
+   * if there is an overflow.
+   *
+   * @param value a long to be casted to an int
+   * @return an int that is == to value
+   * @throws IllegalArgumentException if value can't be casted to an int
+   */
+  public static int checkedCast(long value) {
+    int valueI = (int) value;
+    if (valueI != value) {
+      throw new IllegalArgumentException(String.format("Overflow casting %d to an int", value));
+    }
+    return valueI;
+  }
+}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/org/apache/parquet/Log.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/org/apache/parquet/Log.java b/parquet-common/src/main/java/org/apache/parquet/Log.java
new file mode 100644
index 0000000..a39f4b2
--- /dev/null
+++ b/parquet-common/src/main/java/org/apache/parquet/Log.java
@@ -0,0 +1,206 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.MessageFormat;
+import java.util.Date;
+import java.util.logging.Formatter;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+import java.util.logging.StreamHandler;
+
+/**
+ * Simple wrapper around java.util.logging
+ * Adds compile time log level.
+ * The compiler removes completely if statements that reference to a false constant
+ *
+ * <code>
+ *   if (DEBUG) LOG.debug("removed by the compiler if DEBUG is a false constant")
+ * </code>
+ *
+ * @author Julien Le Dem
+ *
+ */
+public class Log {
+
+  /**
+   * this is the compile time log level
+   */
+  public static final Level LEVEL = Level.INFO; // should be INFO unless for debugging
+
+  public static final boolean DEBUG = (LEVEL.intValue() <= Level.FINE.intValue());
+  public static final boolean INFO = (LEVEL.intValue() <= Level.INFO.intValue());
+  public static final boolean WARN = (LEVEL.intValue() <= Level.WARNING.intValue());
+  public static final boolean ERROR = (LEVEL.intValue() <= Level.SEVERE.intValue());
+
+  static {
+    // add a default handler in case there is none
+    Logger logger = Logger.getLogger(Log.class.getPackage().getName());
+    Handler[] handlers = logger.getHandlers();
+    if (handlers == null || handlers.length == 0) {
+      logger.setUseParentHandlers(false);
+      StreamHandler handler = new StreamHandler(System.out, new Formatter() {
+        Date dat = new Date();
+        private final static String format = "{0,date} {0,time}";
+        private MessageFormat formatter = new MessageFormat(format);
+
+        private Object args[] = new Object[1];
+
+        /**
+         * Format the given LogRecord.
+         * @param record the log record to be formatted.
+         * @return a formatted log record
+         */
+        public synchronized String format(LogRecord record) {
+          StringBuffer sb = new StringBuffer();
+          // Minimize memory allocations here.
+          dat.setTime(record.getMillis());
+          args[0] = dat;
+          formatter.format(args, sb, null);
+          sb.append(" ");
+          sb.append(record.getLevel().getLocalizedName());
+          sb.append(": ");
+          sb.append(record.getLoggerName());
+
+          sb.append(": ");
+          sb.append(formatMessage(record));
+          sb.append("\n");
+          if (record.getThrown() != null) {
+            try {
+              StringWriter sw = new StringWriter();
+              PrintWriter pw = new PrintWriter(sw);
+              record.getThrown().printStackTrace(pw);
+              pw.close();
+              sb.append(sw.toString());
+            } catch (Exception ex) {
+            }
+          }
+          return sb.toString();
+        }
+      });
+      handler.setLevel(LEVEL);
+      logger.addHandler(handler);
+    }
+    logger.setLevel(LEVEL);
+  }
+
+  /**
+   *
+   * @param c the current class
+   * @return the corresponding logger
+   */
+  public static Log getLog(Class<?> c) {
+    return new Log(c);
+  }
+
+  private Logger logger;
+
+  public Log(Class<?> c) {
+    this.logger = Logger.getLogger(c.getName());
+  }
+
+  /**
+   * prints a debug message
+   * @param m
+   */
+  public void debug(Object m) {
+    if (m instanceof Throwable) {
+      logger.log(Level.FINE, "", (Throwable)m);
+    } else {
+      logger.fine(String.valueOf(m));
+    }
+  }
+
+  /**
+   * prints a debug message
+   * @param m
+   * @param t
+   */
+  public void debug(Object m, Throwable t) {
+    logger.log(Level.FINE, String.valueOf(m), t);
+  }
+
+  /**
+   * prints an info message
+   * @param m
+   */
+  public void info(Object m) {
+    if (m instanceof Throwable) {
+      logger.log(Level.INFO, "", (Throwable)m);
+    } else {
+      logger.info(String.valueOf(m));
+    }
+  }
+
+  /**
+   * prints an info message
+   * @param m
+   * @param t
+   */
+  public void info(Object m, Throwable t) {
+    logger.log(Level.INFO, String.valueOf(m), t);
+  }
+
+  /**
+   * prints a warn message
+   * @param m
+   */
+  public void warn(Object m) {
+    if (m instanceof Throwable) {
+      logger.log(Level.WARNING, "", (Throwable)m);
+    } else {
+      logger.warning(String.valueOf(m));
+    }
+  }
+
+  /**
+   * prints a warn message
+   * @param m
+   * @param t
+   */
+  public void warn(Object m, Throwable t) {
+    logger.log(Level.WARNING, String.valueOf(m), t);
+  }
+
+  /**
+   * prints an error message
+   * @param m
+   */
+  public void error(Object m) {
+    if (m instanceof Throwable) {
+      logger.log(Level.SEVERE, "", (Throwable)m);
+    } else {
+      logger.warning(String.valueOf(m));
+    }
+  }
+
+  /**
+   * prints an error message
+   * @param m
+   * @param t
+   */
+  public void error(Object m, Throwable t) {
+    logger.log(Level.SEVERE, String.valueOf(m), t);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/org/apache/parquet/ParquetRuntimeException.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/org/apache/parquet/ParquetRuntimeException.java b/parquet-common/src/main/java/org/apache/parquet/ParquetRuntimeException.java
new file mode 100644
index 0000000..f67b15a
--- /dev/null
+++ b/parquet-common/src/main/java/org/apache/parquet/ParquetRuntimeException.java
@@ -0,0 +1,46 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet;
+
+/**
+ * The parent class for all runtime exceptions
+ *
+ * @author Julien Le Dem
+ *
+ */
+abstract public class ParquetRuntimeException extends RuntimeException {
+  private static final long serialVersionUID = 1L;
+
+  public ParquetRuntimeException() {
+    super();
+  }
+
+  public ParquetRuntimeException(String message, Throwable cause) {
+    super(message, cause);
+  }
+
+  public ParquetRuntimeException(String message) {
+    super(message);
+  }
+
+  public ParquetRuntimeException(Throwable cause) {
+    super(cause);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/org/apache/parquet/Preconditions.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/org/apache/parquet/Preconditions.java b/parquet-common/src/main/java/org/apache/parquet/Preconditions.java
new file mode 100644
index 0000000..81868c7
--- /dev/null
+++ b/parquet-common/src/main/java/org/apache/parquet/Preconditions.java
@@ -0,0 +1,123 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet;
+
+/**
+ * Utility for parameter validation
+ *
+ * @author Julien Le Dem
+ *
+ */
+public final class Preconditions {
+  private Preconditions() { }
+
+  /**
+   * @param o the param to check
+   * @param name the name of the param for the error message
+   * @return the validated o
+   * @throws NullPointerException if o is null
+   */
+  public static <T> T checkNotNull(T o, String name) throws NullPointerException {
+    if (o == null) {
+      throw new NullPointerException(name + " should not be null");
+    }
+    return o;
+  }
+
+  /**
+   * Precondition-style validation that throws {@link IllegalArgumentException}.
+   *
+   * @param isValid
+   *          {@code true} if valid, {@code false} if an exception should be
+   *          thrown
+   * @param message
+   *          A String message for the exception.
+   * @throws IllegalArgumentException if {@code isValid} is false
+   */
+  public static void checkArgument(boolean isValid, String message) throws IllegalArgumentException {
+    if (!isValid) {
+      throw new IllegalArgumentException(message);
+    }
+  }
+
+  /**
+   * Precondition-style validation that throws {@link IllegalArgumentException}.
+   *
+   * @param isValid
+   *          {@code true} if valid, {@code false} if an exception should be
+   *          thrown
+   * @param message
+   *          A String message for the exception.
+   * @param args
+   *          Objects used to fill in {@code %s} placeholders in the message
+   * @throws IllegalArgumentException if {@code isValid} is false
+   */
+  public static void checkArgument(boolean isValid, String message, Object... args)
+      throws IllegalArgumentException {
+    if (!isValid) {
+      throw new IllegalArgumentException(
+          String.format(String.valueOf(message), strings(args)));
+    }
+  }
+
+  /**
+   * Precondition-style validation that throws {@link IllegalStateException}.
+   *
+   * @param isValid
+   *          {@code true} if valid, {@code false} if an exception should be
+   *          thrown
+   * @param message
+   *          A String message for the exception.
+   * @throws IllegalStateException if {@code isValid} is false
+   */
+  public static void checkState(boolean isValid, String message) throws IllegalStateException {
+    if (!isValid) {
+      throw new IllegalStateException(message);
+    }
+  }
+
+  /**
+   * Precondition-style validation that throws {@link IllegalStateException}.
+   *
+   * @param isValid
+   *          {@code true} if valid, {@code false} if an exception should be
+   *          thrown
+   * @param message
+   *          A String message for the exception.
+   * @param args
+   *          Objects used to fill in {@code %s} placeholders in the message
+   * @throws IllegalStateException if {@code isValid} is false
+   */
+  public static void checkState(boolean isValid, String message, Object... args)
+      throws IllegalStateException {
+    if (!isValid) {
+      throw new IllegalStateException(
+          String.format(String.valueOf(message), strings(args)));
+    }
+  }
+
+  private static String[] strings(Object[] objects) {
+    String[] strings = new String[objects.length];
+    for (int i = 0; i < objects.length; i += 1) {
+      strings[i] = String.valueOf(objects[i]);
+    }
+    return strings;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/org/apache/parquet/Version.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/org/apache/parquet/Version.java b/parquet-common/src/main/java/org/apache/parquet/Version.java
new file mode 100644
index 0000000..6580f33
--- /dev/null
+++ b/parquet-common/src/main/java/org/apache/parquet/Version.java
@@ -0,0 +1,103 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.jar.Manifest;
+
+/**
+ * The version of the library
+ *
+ * parquet-mr version 1.0.0-SNAPSHOT (build 6cf94d29b2b7115df4de2c06e2ab4326d721eb55)
+ *
+ * @author Julien Le Dem
+ *
+ */
+public class Version {
+  private static final Log LOG = Log.getLog(Version.class);
+  
+  public static final String VERSION_NUMBER = readVersionNumber();
+  public static final String FULL_VERSION = readFullVersion();
+
+  private static String getJarPath() {
+    final URL versionClassBaseUrl = Version.class.getResource("");
+    if (versionClassBaseUrl.getProtocol().equals("jar")) {
+      String path = versionClassBaseUrl.getPath();
+      int jarEnd = path.indexOf("!");
+      if (jarEnd != -1) {
+        String jarPath = path.substring(0, jarEnd);
+        return jarPath;
+      }
+    }
+    return null;
+  }
+
+  private static URL getResourceFromJar(String jarPath, String path) throws IOException {
+    Enumeration<URL> resources = Version.class.getClassLoader().getResources(path);
+    while (resources.hasMoreElements()) {
+      URL url = resources.nextElement();
+      if (url.getProtocol().equals("jar") && url.getPath().startsWith(jarPath)) {
+        return url;
+      }
+    }
+    return null;
+  }
+  
+  private static String readVersionNumber() {
+    String version = null;
+    try {
+      String jarPath = getJarPath();
+      if (jarPath != null) {
+        URL pomPropertiesUrl = getResourceFromJar(jarPath, "META-INF/maven/com.twitter/parquet-column/pom.properties");
+        if (pomPropertiesUrl != null) {
+          Properties properties = new Properties();
+          properties.load(pomPropertiesUrl.openStream());
+          version = properties.getProperty("version");
+        }
+      }
+    } catch (Exception e) {
+      LOG.warn("can't read from META-INF", e);
+    }
+    return version;
+  }
+
+  private static String readFullVersion() {
+    String sha = null;
+    try {
+      String jarPath = getJarPath();
+      if (jarPath != null) {
+        URL manifestUrl = getResourceFromJar(jarPath, "META-INF/MANIFEST.MF");
+        if (manifestUrl != null) {
+          Manifest manifest = new Manifest(manifestUrl.openStream());
+          sha = manifest.getMainAttributes().getValue("git-SHA-1");
+        }
+      }
+    } catch (Exception e) {
+      LOG.warn("can't read from META-INF", e);
+    }
+    return "parquet-mr" + (VERSION_NUMBER != null ? " version " + VERSION_NUMBER : "") + (sha != null ? " (build " + sha + ")" : "");
+  }
+
+  public static void main(String[] args) {
+    System.out.println(FULL_VERSION);
+  }
+}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/org/apache/parquet/bytes/BytesUtils.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/org/apache/parquet/bytes/BytesUtils.java b/parquet-common/src/main/java/org/apache/parquet/bytes/BytesUtils.java
new file mode 100644
index 0000000..d96a1e5
--- /dev/null
+++ b/parquet-common/src/main/java/org/apache/parquet/bytes/BytesUtils.java
@@ -0,0 +1,269 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet.bytes;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.charset.Charset;
+
+import org.apache.parquet.Log;
+
+/**
+ * utility methods to deal with bytes
+ *
+ * @author Julien Le Dem
+ *
+ */
+public class BytesUtils {
+  private static final Log LOG = Log.getLog(BytesUtils.class);
+
+  public static final Charset UTF8 = Charset.forName("UTF-8");
+
+  /**
+   * give the number of bits needed to encode an int given the max value
+   * @param bound max int that we want to encode
+   * @return the number of bits required
+   */
+  public static int getWidthFromMaxInt(int bound) {
+    return 32 - Integer.numberOfLeadingZeros(bound);
+  }
+
+  /**
+   * reads an int in little endian at the given position
+   * @param in
+   * @param offset
+   * @return
+   * @throws IOException
+   */
+  public static int readIntLittleEndian(byte[] in, int offset) throws IOException {
+    int ch4 = in[offset] & 0xff;
+    int ch3 = in[offset + 1] & 0xff;
+    int ch2 = in[offset + 2] & 0xff;
+    int ch1 = in[offset + 3] & 0xff;
+    return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));
+  }
+
+  public static int readIntLittleEndian(InputStream in) throws IOException {
+    // TODO: this is duplicated code in LittleEndianDataInputStream
+    int ch1 = in.read();
+    int ch2 = in.read();
+    int ch3 = in.read();
+    int ch4 = in.read();
+    if ((ch1 | ch2 | ch3 | ch4) < 0) {
+        throw new EOFException();
+    }
+    return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0));
+  }
+
+  public static int readIntLittleEndianOnOneByte(InputStream in) throws IOException {
+      int ch1 = in.read();
+      if (ch1 < 0) {
+        throw new EOFException();
+      }
+      return ch1;
+  }
+
+  public static int readIntLittleEndianOnTwoBytes(InputStream in) throws IOException {
+      int ch1 = in.read();
+      int ch2 = in.read();
+      if ((ch1 | ch2 ) < 0) {
+          throw new EOFException();
+      }
+      return ((ch2 << 8) + (ch1 << 0));
+  }
+
+  public static int readIntLittleEndianOnThreeBytes(InputStream in) throws IOException {
+      int ch1 = in.read();
+      int ch2 = in.read();
+      int ch3 = in.read();
+      if ((ch1 | ch2 | ch3 ) < 0) {
+          throw new EOFException();
+      }
+      return ((ch3 << 16) + (ch2 << 8) + (ch1 << 0));
+  }
+
+  public static int readIntLittleEndianPaddedOnBitWidth(InputStream in, int bitWidth)
+      throws IOException {
+
+    int bytesWidth = paddedByteCountFromBits(bitWidth);
+    switch (bytesWidth) {
+      case 0:
+        return 0;
+      case 1:
+        return BytesUtils.readIntLittleEndianOnOneByte(in);
+      case 2:
+        return BytesUtils.readIntLittleEndianOnTwoBytes(in);
+      case 3:
+        return  BytesUtils.readIntLittleEndianOnThreeBytes(in);
+      case 4:
+        return BytesUtils.readIntLittleEndian(in);
+      default:
+        throw new IOException(
+          String.format("Encountered bitWidth (%d) that requires more than 4 bytes", bitWidth));
+    }
+  }
+
+  public static void writeIntLittleEndianOnOneByte(OutputStream out, int v) throws IOException {
+    out.write((v >>>  0) & 0xFF);
+  }
+
+  public static void writeIntLittleEndianOnTwoBytes(OutputStream out, int v) throws IOException {
+    out.write((v >>>  0) & 0xFF);
+    out.write((v >>>  8) & 0xFF);
+  }
+
+  public static void writeIntLittleEndianOnThreeBytes(OutputStream out, int v) throws IOException {
+    out.write((v >>>  0) & 0xFF);
+    out.write((v >>>  8) & 0xFF);
+    out.write((v >>> 16) & 0xFF);
+  }
+
+  public static void writeIntLittleEndian(OutputStream out, int v) throws IOException {
+    // TODO: this is duplicated code in LittleEndianDataOutputStream
+    out.write((v >>>  0) & 0xFF);
+    out.write((v >>>  8) & 0xFF);
+    out.write((v >>> 16) & 0xFF);
+    out.write((v >>> 24) & 0xFF);
+    if (Log.DEBUG) LOG.debug("write le int: " + v + " => "+ ((v >>>  0) & 0xFF) + " " + ((v >>>  8) & 0xFF) + " " + ((v >>> 16) & 0xFF) + " " + ((v >>> 24) & 0xFF));
+  }
+
+  /**
+   * Write a little endian int to out, using the the number of bytes required by
+   * bit width
+   */
+  public static void writeIntLittleEndianPaddedOnBitWidth(OutputStream out, int v, int bitWidth)
+      throws IOException {
+
+    int bytesWidth = paddedByteCountFromBits(bitWidth);
+    switch (bytesWidth) {
+      case 0:
+        break;
+      case 1:
+        writeIntLittleEndianOnOneByte(out, v);
+        break;
+      case 2:
+        writeIntLittleEndianOnTwoBytes(out, v);
+        break;
+      case 3:
+        writeIntLittleEndianOnThreeBytes(out, v);
+        break;
+      case 4:
+        writeIntLittleEndian(out, v);
+        break;
+      default:
+        throw new IOException(
+          String.format("Encountered value (%d) that requires more than 4 bytes", v));
+    }
+  }
+
+  public static int readUnsignedVarInt(InputStream in) throws IOException {
+    int value = 0;
+    int i = 0;
+    int b;
+    while (((b = in.read()) & 0x80) != 0) {
+      value |= (b & 0x7F) << i;
+      i += 7;
+    }
+    return value | (b << i);
+  }
+
+  /**
+   * uses a trick mentioned in https://developers.google.com/protocol-buffers/docs/encoding to read zigZag encoded data
+   * @param in
+   * @return
+   * @throws IOException
+   */
+  public static int readZigZagVarInt(InputStream in) throws IOException {
+    int raw = readUnsignedVarInt(in);
+    int temp = (((raw << 31) >> 31) ^ raw) >> 1;
+    return temp ^ (raw & (1 << 31));
+  }
+
+  public static void writeUnsignedVarInt(int value, OutputStream out) throws IOException {
+    while ((value & 0xFFFFFF80) != 0L) {
+      out.write((value & 0x7F) | 0x80);
+      value >>>= 7;
+    }
+    out.write(value & 0x7F);
+  }
+
+  public static void writeZigZagVarInt(int intValue, OutputStream out) throws IOException{
+    writeUnsignedVarInt((intValue << 1) ^ (intValue >> 31), out);
+  }
+
+  /**
+   * @param bitLength a count of bits
+   * @return the corresponding byte count padded to the next byte
+   */
+  public static int paddedByteCountFromBits(int bitLength) {
+    return (bitLength + 7) / 8;
+  }
+
+  public static byte[] intToBytes(int value) {
+    byte[] outBuffer = new byte[4];
+    outBuffer[3] = (byte)(value >>> 24);
+    outBuffer[2] = (byte)(value >>> 16);
+    outBuffer[1] = (byte)(value >>>  8);
+    outBuffer[0] = (byte)(value >>>  0);
+    return outBuffer;
+  }
+
+  public static int bytesToInt(byte[] bytes) {
+    return ((int)(bytes[3] & 255) << 24) +
+           ((int)(bytes[2] & 255) << 16) +
+           ((int)(bytes[1] & 255) <<  8) +
+           ((int)(bytes[0] & 255) <<  0);
+  }
+
+  public static byte[] longToBytes(long value) {
+    byte[] outBuffer = new byte[8];
+    outBuffer[7] = (byte)(value >>> 56);
+    outBuffer[6] = (byte)(value >>> 48);
+    outBuffer[5] = (byte)(value >>> 40);
+    outBuffer[4] = (byte)(value >>> 32);
+    outBuffer[3] = (byte)(value >>> 24);
+    outBuffer[2] = (byte)(value >>> 16);
+    outBuffer[1] = (byte)(value >>>  8);
+    outBuffer[0] = (byte)(value >>>  0);
+    return outBuffer;
+  }
+
+  public static long bytesToLong(byte[] bytes) {
+    return (((long)bytes[7] << 56) +
+           ((long)(bytes[6] & 255) << 48) +
+           ((long)(bytes[5] & 255) << 40) +
+           ((long)(bytes[4] & 255) << 32) +
+           ((long)(bytes[3] & 255) << 24) +
+           ((long)(bytes[2] & 255) << 16) +
+           ((long)(bytes[1] & 255) <<  8) +
+           ((long)(bytes[0] & 255) <<  0));
+  }
+
+  public static byte[] booleanToBytes(boolean value) {
+    byte[] outBuffer = new byte[1];
+    outBuffer[0] = (byte)(value ? 1 : 0);
+    return outBuffer;
+  }
+
+  public static boolean bytesToBool(byte[] bytes) {
+    return ((int)(bytes[0] & 255) != 0);
+  }
+}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/org/apache/parquet/hadoop/metadata/Canonicalizer.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/org/apache/parquet/hadoop/metadata/Canonicalizer.java b/parquet-common/src/main/java/org/apache/parquet/hadoop/metadata/Canonicalizer.java
new file mode 100644
index 0000000..b5c08cc
--- /dev/null
+++ b/parquet-common/src/main/java/org/apache/parquet/hadoop/metadata/Canonicalizer.java
@@ -0,0 +1,62 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet.hadoop.metadata;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * returns canonical representation of objects (similar to String.intern()) to save memory
+ * if a.equals(b) then canonicalize(a) == canonicalize(b)
+ * this class is thread safe
+ * @author Julien Le Dem
+ *
+ * @param <T>
+ */
+public class Canonicalizer<T> {
+
+  private ConcurrentHashMap<T, T> canonicals = new ConcurrentHashMap<T, T>();
+
+  /**
+   * @param value the value to canonicalize
+   * @return the corresponding canonical value
+   */
+  final public T canonicalize(T value) {
+    T canonical = canonicals.get(value);
+    if (canonical == null) {
+      value = toCanonical(value);
+      T existing = canonicals.putIfAbsent(value, value);
+      // putIfAbsent is atomic, making sure we always return the same canonical representation of the value
+      if (existing == null) {
+        canonical = value;
+      } else {
+        canonical = existing;
+      }
+    }
+    return canonical;
+  }
+
+  /**
+   * @param value the value to canonicalize if needed
+   * @return the canonicalized value
+   */
+  protected T toCanonical(T value) {
+    return value;
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/org/apache/parquet/hadoop/metadata/ColumnPath.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/org/apache/parquet/hadoop/metadata/ColumnPath.java b/parquet-common/src/main/java/org/apache/parquet/hadoop/metadata/ColumnPath.java
new file mode 100644
index 0000000..a34cb91
--- /dev/null
+++ b/parquet-common/src/main/java/org/apache/parquet/hadoop/metadata/ColumnPath.java
@@ -0,0 +1,97 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet.hadoop.metadata;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import static org.apache.parquet.Preconditions.checkNotNull;
+
+public final class ColumnPath implements Iterable<String>, Serializable {
+
+  private static Canonicalizer<ColumnPath> paths = new Canonicalizer<ColumnPath>() {
+    @Override
+    protected ColumnPath toCanonical(ColumnPath value) {
+      String[] path = new String[value.p.length];
+      for (int i = 0; i < value.p.length; i++) {
+        path[i] = value.p[i].intern();
+      }
+      return new ColumnPath(path);
+    }
+  };
+
+  public static ColumnPath fromDotString(String path) {
+    checkNotNull(path, "path");
+    return get(path.split("\\."));
+  }
+
+  public static ColumnPath get(String... path){
+    return paths.canonicalize(new ColumnPath(path));
+  }
+
+  private final String[] p;
+
+  private ColumnPath(String[] path) {
+    this.p = path;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj instanceof ColumnPath) {
+      return Arrays.equals(p, ((ColumnPath)obj).p);
+    }
+    return false;
+  }
+
+  @Override
+  public int hashCode() {
+    return Arrays.hashCode(p);
+  }
+
+  public String toDotString() {
+    Iterator<String> iter = Arrays.asList(p).iterator();
+    StringBuilder sb = new StringBuilder();
+    while (iter.hasNext()) {
+      sb.append(iter.next());
+      if (iter.hasNext()) {
+        sb.append('.');
+      }
+    }
+    return sb.toString();
+  }
+
+  @Override
+  public String toString() {
+    return Arrays.toString(p);
+  }
+
+  @Override
+  public Iterator<String> iterator() {
+    return Arrays.asList(p).iterator();
+  }
+
+  public int size() {
+    return p.length;
+  }
+
+  public String[] toArray() {
+    return p;
+  }
+}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/parquet/Closeables.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/parquet/Closeables.java b/parquet-common/src/main/java/parquet/Closeables.java
deleted file mode 100644
index 728d258..0000000
--- a/parquet-common/src/main/java/parquet/Closeables.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package parquet;
-
-import java.io.Closeable;
-import java.io.IOException;
-
-/**
- * Utility for working with {@link java.io.Closeable}ss
- */
-public final class Closeables {
-  private Closeables() { }
-
-  private static final Log LOG = Log.getLog(Closeables.class);
-
-  /**
-   * Closes a (potentially null) closeable.
-   * @param c can be null
-   * @throws IOException if c.close() throws an IOException.
-   */
-  public static void close(Closeable c) throws IOException {
-    if (c == null) { return; }
-    c.close();
-  }
-
-  /**
-   * Closes a (potentially null) closeable, swallowing any IOExceptions thrown by
-   * c.close(). The exception will be logged.
-   * @param c can be null
-   */
-  public static void closeAndSwallowIOExceptions(Closeable c) {
-    if (c == null) { return; }
-    try {
-      c.close();
-    } catch (IOException e) {
-      LOG.warn("Encountered exception closing closeable", e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/parquet/Ints.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/parquet/Ints.java b/parquet-common/src/main/java/parquet/Ints.java
deleted file mode 100644
index 97721a4..0000000
--- a/parquet-common/src/main/java/parquet/Ints.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package parquet;
-
-/**
- * Utilities for working with ints
- *
- * @author Alex Levenson
- */
-public final class Ints {
-  private Ints() { }
-
-  /**
-   * Cast value to a an int, or throw an exception
-   * if there is an overflow.
-   *
-   * @param value a long to be casted to an int
-   * @return an int that is == to value
-   * @throws IllegalArgumentException if value can't be casted to an int
-   */
-  public static int checkedCast(long value) {
-    int valueI = (int) value;
-    if (valueI != value) {
-      throw new IllegalArgumentException(String.format("Overflow casting %d to an int", value));
-    }
-    return valueI;
-  }
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/parquet/Log.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/parquet/Log.java b/parquet-common/src/main/java/parquet/Log.java
deleted file mode 100644
index f28835f..0000000
--- a/parquet-common/src/main/java/parquet/Log.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package parquet;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.MessageFormat;
-import java.util.Date;
-import java.util.logging.Formatter;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-import java.util.logging.StreamHandler;
-
-/**
- * Simple wrapper around java.util.logging
- * Adds compile time log level.
- * The compiler removes completely if statements that reference to a false constant
- *
- * <code>
- *   if (DEBUG) LOG.debug("removed by the compiler if DEBUG is a false constant")
- * </code>
- *
- * @author Julien Le Dem
- *
- */
-public class Log {
-
-  /**
-   * this is the compile time log level
-   */
-  public static final Level LEVEL = Level.INFO; // should be INFO unless for debugging
-
-  public static final boolean DEBUG = (LEVEL.intValue() <= Level.FINE.intValue());
-  public static final boolean INFO = (LEVEL.intValue() <= Level.INFO.intValue());
-  public static final boolean WARN = (LEVEL.intValue() <= Level.WARNING.intValue());
-  public static final boolean ERROR = (LEVEL.intValue() <= Level.SEVERE.intValue());
-
-  static {
-    // add a default handler in case there is none
-    Logger logger = Logger.getLogger(Log.class.getPackage().getName());
-    Handler[] handlers = logger.getHandlers();
-    if (handlers == null || handlers.length == 0) {
-      logger.setUseParentHandlers(false);
-      StreamHandler handler = new StreamHandler(System.out, new Formatter() {
-        Date dat = new Date();
-        private final static String format = "{0,date} {0,time}";
-        private MessageFormat formatter = new MessageFormat(format);
-
-        private Object args[] = new Object[1];
-
-        /**
-         * Format the given LogRecord.
-         * @param record the log record to be formatted.
-         * @return a formatted log record
-         */
-        public synchronized String format(LogRecord record) {
-          StringBuffer sb = new StringBuffer();
-          // Minimize memory allocations here.
-          dat.setTime(record.getMillis());
-          args[0] = dat;
-          formatter.format(args, sb, null);
-          sb.append(" ");
-          sb.append(record.getLevel().getLocalizedName());
-          sb.append(": ");
-          sb.append(record.getLoggerName());
-
-          sb.append(": ");
-          sb.append(formatMessage(record));
-          sb.append("\n");
-          if (record.getThrown() != null) {
-            try {
-              StringWriter sw = new StringWriter();
-              PrintWriter pw = new PrintWriter(sw);
-              record.getThrown().printStackTrace(pw);
-              pw.close();
-              sb.append(sw.toString());
-            } catch (Exception ex) {
-            }
-          }
-          return sb.toString();
-        }
-      });
-      handler.setLevel(LEVEL);
-      logger.addHandler(handler);
-    }
-    logger.setLevel(LEVEL);
-  }
-
-  /**
-   *
-   * @param c the current class
-   * @return the corresponding logger
-   */
-  public static Log getLog(Class<?> c) {
-    return new Log(c);
-  }
-
-  private Logger logger;
-
-  public Log(Class<?> c) {
-    this.logger = Logger.getLogger(c.getName());
-  }
-
-  /**
-   * prints a debug message
-   * @param m
-   */
-  public void debug(Object m) {
-    if (m instanceof Throwable) {
-      logger.log(Level.FINE, "", (Throwable)m);
-    } else {
-      logger.fine(String.valueOf(m));
-    }
-  }
-
-  /**
-   * prints a debug message
-   * @param m
-   * @param t
-   */
-  public void debug(Object m, Throwable t) {
-    logger.log(Level.FINE, String.valueOf(m), t);
-  }
-
-  /**
-   * prints an info message
-   * @param m
-   */
-  public void info(Object m) {
-    if (m instanceof Throwable) {
-      logger.log(Level.INFO, "", (Throwable)m);
-    } else {
-      logger.info(String.valueOf(m));
-    }
-  }
-
-  /**
-   * prints an info message
-   * @param m
-   * @param t
-   */
-  public void info(Object m, Throwable t) {
-    logger.log(Level.INFO, String.valueOf(m), t);
-  }
-
-  /**
-   * prints a warn message
-   * @param m
-   */
-  public void warn(Object m) {
-    if (m instanceof Throwable) {
-      logger.log(Level.WARNING, "", (Throwable)m);
-    } else {
-      logger.warning(String.valueOf(m));
-    }
-  }
-
-  /**
-   * prints a warn message
-   * @param m
-   * @param t
-   */
-  public void warn(Object m, Throwable t) {
-    logger.log(Level.WARNING, String.valueOf(m), t);
-  }
-
-  /**
-   * prints an error message
-   * @param m
-   */
-  public void error(Object m) {
-    if (m instanceof Throwable) {
-      logger.log(Level.SEVERE, "", (Throwable)m);
-    } else {
-      logger.warning(String.valueOf(m));
-    }
-  }
-
-  /**
-   * prints an error message
-   * @param m
-   * @param t
-   */
-  public void error(Object m, Throwable t) {
-    logger.log(Level.SEVERE, String.valueOf(m), t);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/parquet/ParquetRuntimeException.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/parquet/ParquetRuntimeException.java b/parquet-common/src/main/java/parquet/ParquetRuntimeException.java
deleted file mode 100644
index b3f73d5..0000000
--- a/parquet-common/src/main/java/parquet/ParquetRuntimeException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package parquet;
-
-/**
- * The parent class for all runtime exceptions
- *
- * @author Julien Le Dem
- *
- */
-abstract public class ParquetRuntimeException extends RuntimeException {
-  private static final long serialVersionUID = 1L;
-
-  public ParquetRuntimeException() {
-    super();
-  }
-
-  public ParquetRuntimeException(String message, Throwable cause) {
-    super(message, cause);
-  }
-
-  public ParquetRuntimeException(String message) {
-    super(message);
-  }
-
-  public ParquetRuntimeException(Throwable cause) {
-    super(cause);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/parquet/Preconditions.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/parquet/Preconditions.java b/parquet-common/src/main/java/parquet/Preconditions.java
deleted file mode 100644
index 1292b83..0000000
--- a/parquet-common/src/main/java/parquet/Preconditions.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package parquet;
-
-/**
- * Utility for parameter validation
- *
- * @author Julien Le Dem
- *
- */
-public final class Preconditions {
-  private Preconditions() { }
-
-  /**
-   * @param o the param to check
-   * @param name the name of the param for the error message
-   * @return the validated o
-   * @throws NullPointerException if o is null
-   */
-  public static <T> T checkNotNull(T o, String name) throws NullPointerException {
-    if (o == null) {
-      throw new NullPointerException(name + " should not be null");
-    }
-    return o;
-  }
-
-  /**
-   * Precondition-style validation that throws {@link IllegalArgumentException}.
-   *
-   * @param isValid
-   *          {@code true} if valid, {@code false} if an exception should be
-   *          thrown
-   * @param message
-   *          A String message for the exception.
-   * @throws IllegalArgumentException if {@code isValid} is false
-   */
-  public static void checkArgument(boolean isValid, String message) throws IllegalArgumentException {
-    if (!isValid) {
-      throw new IllegalArgumentException(message);
-    }
-  }
-
-  /**
-   * Precondition-style validation that throws {@link IllegalArgumentException}.
-   *
-   * @param isValid
-   *          {@code true} if valid, {@code false} if an exception should be
-   *          thrown
-   * @param message
-   *          A String message for the exception.
-   * @param args
-   *          Objects used to fill in {@code %s} placeholders in the message
-   * @throws IllegalArgumentException if {@code isValid} is false
-   */
-  public static void checkArgument(boolean isValid, String message, Object... args)
-      throws IllegalArgumentException {
-    if (!isValid) {
-      throw new IllegalArgumentException(
-          String.format(String.valueOf(message), strings(args)));
-    }
-  }
-
-  /**
-   * Precondition-style validation that throws {@link IllegalStateException}.
-   *
-   * @param isValid
-   *          {@code true} if valid, {@code false} if an exception should be
-   *          thrown
-   * @param message
-   *          A String message for the exception.
-   * @throws IllegalStateException if {@code isValid} is false
-   */
-  public static void checkState(boolean isValid, String message) throws IllegalStateException {
-    if (!isValid) {
-      throw new IllegalStateException(message);
-    }
-  }
-
-  /**
-   * Precondition-style validation that throws {@link IllegalStateException}.
-   *
-   * @param isValid
-   *          {@code true} if valid, {@code false} if an exception should be
-   *          thrown
-   * @param message
-   *          A String message for the exception.
-   * @param args
-   *          Objects used to fill in {@code %s} placeholders in the message
-   * @throws IllegalStateException if {@code isValid} is false
-   */
-  public static void checkState(boolean isValid, String message, Object... args)
-      throws IllegalStateException {
-    if (!isValid) {
-      throw new IllegalStateException(
-          String.format(String.valueOf(message), strings(args)));
-    }
-  }
-
-  private static String[] strings(Object[] objects) {
-    String[] strings = new String[objects.length];
-    for (int i = 0; i < objects.length; i += 1) {
-      strings[i] = String.valueOf(objects[i]);
-    }
-    return strings;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-common/src/main/java/parquet/Version.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/main/java/parquet/Version.java b/parquet-common/src/main/java/parquet/Version.java
deleted file mode 100644
index e260972..0000000
--- a/parquet-common/src/main/java/parquet/Version.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package parquet;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Properties;
-import java.util.jar.Manifest;
-
-/**
- * The version of the library
- *
- * parquet-mr version 1.0.0-SNAPSHOT (build 6cf94d29b2b7115df4de2c06e2ab4326d721eb55)
- *
- * @author Julien Le Dem
- *
- */
-public class Version {
-  private static final Log LOG = Log.getLog(Version.class);
-  
-  public static final String VERSION_NUMBER = readVersionNumber();
-  public static final String FULL_VERSION = readFullVersion();
-
-  private static String getJarPath() {
-    final URL versionClassBaseUrl = Version.class.getResource("");
-    if (versionClassBaseUrl.getProtocol().equals("jar")) {
-      String path = versionClassBaseUrl.getPath();
-      int jarEnd = path.indexOf("!");
-      if (jarEnd != -1) {
-        String jarPath = path.substring(0, jarEnd);
-        return jarPath;
-      }
-    }
-    return null;
-  }
-
-  private static URL getResourceFromJar(String jarPath, String path) throws IOException {
-    Enumeration<URL> resources = Version.class.getClassLoader().getResources(path);
-    while (resources.hasMoreElements()) {
-      URL url = resources.nextElement();
-      if (url.getProtocol().equals("jar") && url.getPath().startsWith(jarPath)) {
-        return url;
-      }
-    }
-    return null;
-  }
-  
-  private static String readVersionNumber() {
-    String version = null;
-    try {
-      String jarPath = getJarPath();
-      if (jarPath != null) {
-        URL pomPropertiesUrl = getResourceFromJar(jarPath, "META-INF/maven/com.twitter/parquet-column/pom.properties");
-        if (pomPropertiesUrl != null) {
-          Properties properties = new Properties();
-          properties.load(pomPropertiesUrl.openStream());
-          version = properties.getProperty("version");
-        }
-      }
-    } catch (Exception e) {
-      LOG.warn("can't read from META-INF", e);
-    }
-    return version;
-  }
-
-  private static String readFullVersion() {
-    String sha = null;
-    try {
-      String jarPath = getJarPath();
-      if (jarPath != null) {
-        URL manifestUrl = getResourceFromJar(jarPath, "META-INF/MANIFEST.MF");
-        if (manifestUrl != null) {
-          Manifest manifest = new Manifest(manifestUrl.openStream());
-          sha = manifest.getMainAttributes().getValue("git-SHA-1");
-        }
-      }
-    } catch (Exception e) {
-      LOG.warn("can't read from META-INF", e);
-    }
-    return "parquet-mr" + (VERSION_NUMBER != null ? " version " + VERSION_NUMBER : "") + (sha != null ? " (build " + sha + ")" : "");
-  }
-
-  public static void main(String[] args) {
-    System.out.println(FULL_VERSION);
-  }
-}


Mime
View raw message