parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [34/51] [partial] parquet-mr git commit: PARQUET-23: Rename to org.apache.parquet.
Date Mon, 27 Apr 2015 23:12:31 GMT
http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/page/DataPageV2.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/page/DataPageV2.java b/parquet-column/src/main/java/parquet/column/page/DataPageV2.java
deleted file mode 100644
index 84fd255..0000000
--- a/parquet-column/src/main/java/parquet/column/page/DataPageV2.java
+++ /dev/null
@@ -1,156 +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.column.page;
-
-import parquet.Ints;
-import parquet.bytes.BytesInput;
-import parquet.column.Encoding;
-import parquet.column.statistics.Statistics;
-
-public class DataPageV2 extends DataPage {
-
-  /**
-   * @param rowCount
-   * @param nullCount
-   * @param valueCount
-   * @param repetitionLevels RLE encoded repetition levels
-   * @param definitionLevels RLE encoded definition levels
-   * @param dataEncoding encoding for the data
-   * @param data data encoded with dataEncoding
-   * @param statistics optional statistics for this page
-   * @return an uncompressed page
-   */
-  public static DataPageV2 uncompressed(
-      int rowCount, int nullCount, int valueCount,
-      BytesInput repetitionLevels, BytesInput definitionLevels,
-      Encoding dataEncoding, BytesInput data,
-      Statistics<?> statistics) {
-    return new DataPageV2(
-        rowCount, nullCount, valueCount,
-        repetitionLevels, definitionLevels,
-        dataEncoding, data,
-        Ints.checkedCast(repetitionLevels.size() + definitionLevels.size() + data.size()),
-        statistics,
-        false);
-  }
-
-  /**
-   * @param rowCount
-   * @param nullCount
-   * @param valueCount
-   * @param repetitionLevels RLE encoded repetition levels
-   * @param definitionLevels RLE encoded definition levels
-   * @param dataEncoding encoding for the data
-   * @param data data encoded with dataEncoding and compressed
-   * @param uncompressedSize total size uncompressed (rl + dl + data)
-   * @param statistics optional statistics for this page
-   * @return a compressed page
-   */
-  public static DataPageV2 compressed(
-      int rowCount, int nullCount, int valueCount,
-      BytesInput repetitionLevels, BytesInput definitionLevels,
-      Encoding dataEncoding, BytesInput data,
-      int uncompressedSize,
-      Statistics<?> statistics) {
-    return new DataPageV2(
-        rowCount, nullCount, valueCount,
-        repetitionLevels, definitionLevels,
-        dataEncoding, data,
-        uncompressedSize,
-        statistics,
-        true);
-  }
-
-  private final int rowCount;
-  private final int nullCount;
-  private final BytesInput repetitionLevels;
-  private final BytesInput definitionLevels;
-  private final Encoding dataEncoding;
-  private final BytesInput data;
-  private final Statistics<?> statistics;
-  private final boolean isCompressed;
-
-  public DataPageV2(
-      int rowCount, int nullCount, int valueCount,
-      BytesInput repetitionLevels, BytesInput definitionLevels,
-      Encoding dataEncoding, BytesInput data,
-      int uncompressedSize,
-      Statistics<?> statistics,
-      boolean isCompressed) {
-    super(Ints.checkedCast(repetitionLevels.size() + definitionLevels.size() + data.size()), uncompressedSize, valueCount);
-    this.rowCount = rowCount;
-    this.nullCount = nullCount;
-    this.repetitionLevels = repetitionLevels;
-    this.definitionLevels = definitionLevels;
-    this.dataEncoding = dataEncoding;
-    this.data = data;
-    this.statistics = statistics;
-    this.isCompressed = isCompressed;
-  }
-
-  public int getRowCount() {
-    return rowCount;
-  }
-
-  public int getNullCount() {
-    return nullCount;
-  }
-
-  public BytesInput getRepetitionLevels() {
-    return repetitionLevels;
-  }
-
-  public BytesInput getDefinitionLevels() {
-    return definitionLevels;
-  }
-
-  public Encoding getDataEncoding() {
-    return dataEncoding;
-  }
-
-  public BytesInput getData() {
-    return data;
-  }
-
-  public Statistics<?> getStatistics() {
-    return statistics;
-  }
-
-  public boolean isCompressed() {
-    return isCompressed;
-  }
-
-  @Override
-  public <T> T accept(Visitor<T> visitor) {
-    return visitor.visit(this);
-  }
-
-  @Override
-  public String toString() {
-    return "Page V2 ["
-        + "dl size=" + definitionLevels.size() + ", "
-        + "rl size=" + repetitionLevels.size() + ", "
-        + "data size=" + data.size() + ", "
-        + "data enc=" + dataEncoding + ", "
-        + "valueCount=" + getValueCount() + ", "
-        + "rowCount=" + getRowCount() + ", "
-        + "is compressed=" + isCompressed + ", "
-        + "uncompressedSize=" + getUncompressedSize() + "]";
-  }
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/page/DictionaryPage.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/page/DictionaryPage.java b/parquet-column/src/main/java/parquet/column/page/DictionaryPage.java
deleted file mode 100644
index a3b74ab..0000000
--- a/parquet-column/src/main/java/parquet/column/page/DictionaryPage.java
+++ /dev/null
@@ -1,88 +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.column.page;
-
-import static parquet.Preconditions.checkNotNull;
-
-import java.io.IOException;
-
-import parquet.Ints;
-import parquet.bytes.BytesInput;
-import parquet.column.Encoding;
-
-/**
- * Data for a dictionary page
- *
- * @author Julien Le Dem
- *
- */
-public class DictionaryPage extends Page {
-
-  private final BytesInput bytes;
-  private final int dictionarySize;
-  private final Encoding encoding;
-
-  /**
-   * creates an uncompressed page
-   * @param bytes the content of the page
-   * @param dictionarySize the value count in the dictionary
-   * @param encoding the encoding used
-   */
-  public DictionaryPage(BytesInput bytes, int dictionarySize, Encoding encoding) {
-    this(bytes, (int)bytes.size(), dictionarySize, encoding); // TODO: fix sizes long or int
-  }
-
-  /**
-   * creates a dictionary page
-   * @param bytes the (possibly compressed) content of the page
-   * @param uncompressedSize the size uncompressed
-   * @param dictionarySize the value count in the dictionary
-   * @param encoding the encoding used
-   */
-  public DictionaryPage(BytesInput bytes, int uncompressedSize, int dictionarySize, Encoding encoding) {
-    super(Ints.checkedCast(bytes.size()), uncompressedSize);
-    this.bytes = checkNotNull(bytes, "bytes");
-    this.dictionarySize = dictionarySize;
-    this.encoding = checkNotNull(encoding, "encoding");
-  }
-
-  public BytesInput getBytes() {
-    return bytes;
-  }
-
-  public int getDictionarySize() {
-    return dictionarySize;
-  }
-
-  public Encoding getEncoding() {
-    return encoding;
-  }
-
-  public DictionaryPage copy() throws IOException {
-    return new DictionaryPage(BytesInput.copy(bytes), getUncompressedSize(), dictionarySize, encoding);
-  }
-
-
-  @Override
-  public String toString() {
-    return "Page [bytes.size=" + bytes.size() + ", entryCount=" + dictionarySize + ", uncompressedSize=" + getUncompressedSize() + ", encoding=" + encoding + "]";
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/page/Page.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/page/Page.java b/parquet-column/src/main/java/parquet/column/page/Page.java
deleted file mode 100644
index eb38eda..0000000
--- a/parquet-column/src/main/java/parquet/column/page/Page.java
+++ /dev/null
@@ -1,49 +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.column.page;
-
-/**
- * one page in a chunk
- *
- * @author Julien Le Dem
- *
- */
-abstract public class Page {
-
-  private final int compressedSize;
-  private final int uncompressedSize;
-
-  Page(int compressedSize, int uncompressedSize) {
-    super();
-    this.compressedSize = compressedSize;
-    this.uncompressedSize = uncompressedSize;
-  }
-
-  public int getCompressedSize() {
-    return compressedSize;
-  }
-
- /**
-  * @return the uncompressed size of the page when the bytes are compressed
-  */
-  public int getUncompressedSize() {
-    return uncompressedSize;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/page/PageReadStore.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/page/PageReadStore.java b/parquet-column/src/main/java/parquet/column/page/PageReadStore.java
deleted file mode 100644
index eddc3e8..0000000
--- a/parquet-column/src/main/java/parquet/column/page/PageReadStore.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.column.page;
-
-import parquet.column.ColumnDescriptor;
-
-/**
- * contains all the readers for all the columns of the corresponding row group
- *
- * TODO: rename to RowGroup?
- * 
- * @author Julien Le Dem
- *
- */
-public interface PageReadStore {
-
-  /**
-   *
-   * @param descriptor the descriptor of the column
-   * @return the page reader for that column
-   */
-  PageReader getPageReader(ColumnDescriptor descriptor);
-
-  /**
-   *
-   * @return the total number of rows in that row group
-   */
-  long getRowCount();
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/page/PageReader.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/page/PageReader.java b/parquet-column/src/main/java/parquet/column/page/PageReader.java
deleted file mode 100644
index d985359..0000000
--- a/parquet-column/src/main/java/parquet/column/page/PageReader.java
+++ /dev/null
@@ -1,43 +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.column.page;
-
-/**
- * Reader for a sequence a page from a given column chunk
- *
- * @author Julien Le Dem
- *
- */
-public interface PageReader {
-
- /**
-  * @return the dictionary page in that chunk or null if none
-  */
-  DictionaryPage readDictionaryPage();
-
-  /**
-   * @return the total number of values in the column chunk
-   */
-  long getTotalValueCount();
-
-  /**
-   * @return the next page in that chunk or null if after the last page
-   */
-  DataPage readPage();
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/page/PageWriteStore.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/page/PageWriteStore.java b/parquet-column/src/main/java/parquet/column/page/PageWriteStore.java
deleted file mode 100644
index 47bd778..0000000
--- a/parquet-column/src/main/java/parquet/column/page/PageWriteStore.java
+++ /dev/null
@@ -1,38 +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.column.page;
-
-import parquet.column.ColumnDescriptor;
-
-/**
- * contains all the writers for the columns in the corresponding row group
- *
- * @author Julien Le Dem
- *
- */
-public interface PageWriteStore {
-
-  /**
-   *
-   * @param path the descriptor for the column
-   * @return the corresponding page writer
-   */
-  PageWriter getPageWriter(ColumnDescriptor path);
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/page/PageWriter.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/page/PageWriter.java b/parquet-column/src/main/java/parquet/column/page/PageWriter.java
deleted file mode 100644
index 5a229a9..0000000
--- a/parquet-column/src/main/java/parquet/column/page/PageWriter.java
+++ /dev/null
@@ -1,89 +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.column.page;
-
-import java.io.IOException;
-
-import parquet.bytes.BytesInput;
-import parquet.column.Encoding;
-import parquet.column.statistics.Statistics;
-
-/**
- * a writer for all the pages of a given column chunk
- *
- * @author Julien Le Dem
- *
- */
-public interface PageWriter {
-
-  /**
-   * writes a single page
-   * @param bytesInput the bytes for the page
-   * @param valueCount the number of values in that page
-   * @param statistics the statistics for that page
-   * @param rlEncoding repetition level encoding
-   * @param dlEncoding definition level encoding
-   * @param valuesEncoding values encoding
-   * @throws IOException
-   */
-  void writePage(BytesInput bytesInput, int valueCount, Statistics<?> statistics, Encoding rlEncoding, Encoding dlEncoding, Encoding valuesEncoding) throws IOException;
-
-  /**
-   * writes a single page in the new format
-   * @param rowCount the number of rows in this page
-   * @param nullCount the number of null values (out of valueCount)
-   * @param valueCount the number of values in that page (there could be multiple values per row for repeated fields)
-   * @param repetitionLevels the repetition levels encoded in RLE without any size header
-   * @param definitionLevels the definition levels encoded in RLE without any size header
-   * @param dataEncoding the encoding for the data
-   * @param data the data encoded with dataEncoding
-   * @param statistics optional stats for this page
-   * @param metadata optional free form key values
-   * @throws IOException
-   */
-  void writePageV2(
-      int rowCount, int nullCount, int valueCount,
-      BytesInput repetitionLevels, BytesInput definitionLevels,
-      Encoding dataEncoding,
-      BytesInput data,
-      Statistics<?> statistics) throws IOException;
-
-  /**
-   * @return the current size used in the memory buffer for that column chunk
-   */
-  long getMemSize();
-
-  /**
-   * @return the allocated size for the buffer ( > getMemSize() )
-   */
-  long allocatedSize();
-
-  /**
-   * writes a dictionary page
-   * @param dictionaryPage the dictionary page containing the dictionary data
-   */
-  void writeDictionaryPage(DictionaryPage dictionaryPage) throws IOException;
-
-  /**
-   * @param prefix a prefix header to add at every line
-   * @return a string presenting a summary of how memory is used
-   */
-  String memUsageString(String prefix);
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/statistics/BinaryStatistics.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/statistics/BinaryStatistics.java b/parquet-column/src/main/java/parquet/column/statistics/BinaryStatistics.java
deleted file mode 100644
index 45ea235..0000000
--- a/parquet-column/src/main/java/parquet/column/statistics/BinaryStatistics.java
+++ /dev/null
@@ -1,108 +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.column.statistics;
-
-import parquet.io.api.Binary;
-
-public class BinaryStatistics extends Statistics<Binary> {
-
-  private Binary max;
-  private Binary min;
-
-  @Override
-  public void updateStats(Binary value) {
-    if (!this.hasNonNullValue()) {
-      initializeStats(value, value);
-    } else {
-      updateStats(value, value);
-    }
-  }
-
-  @Override
-  public void mergeStatisticsMinMax(Statistics stats) {
-    BinaryStatistics binaryStats = (BinaryStatistics)stats;
-    if (!this.hasNonNullValue()) {
-      initializeStats(binaryStats.getMin(), binaryStats.getMax());
-    } else {
-      updateStats(binaryStats.getMin(), binaryStats.getMax());
-    }
-  }
-
-  @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
-    max = Binary.fromByteArray(maxBytes);
-    min = Binary.fromByteArray(minBytes);
-    this.markAsNotEmpty();
-  }
-
-  @Override
-  public byte[] getMaxBytes() {
-    return max.getBytes();
-  }
-
-  @Override
-  public byte[] getMinBytes() {
-    return min.getBytes();
-  }
-
-  @Override
-  public String toString() {
-    if (this.hasNonNullValue())
-      return String.format("min: %s, max: %s, num_nulls: %d", min.toStringUsingUTF8(), max.toStringUsingUTF8(), this.getNumNulls());
-   else if (!this.isEmpty())
-      return String.format("num_nulls: %d, min/max not defined", this.getNumNulls());
-   else
-      return "no stats for this column";
-  }
-
-  public void updateStats(Binary min_value, Binary max_value) {
-    if (min.compareTo(min_value) > 0) { min = min_value; }
-    if (max.compareTo(max_value) < 0) { max = max_value; }
-  }
-
-  public void initializeStats(Binary min_value, Binary max_value) {
-      min = min_value;
-      max = max_value;
-      this.markAsNotEmpty();
-  }
-
-  @Override
-  public Binary genericGetMin() {
-    return min;
-  }
-
-  @Override
-  public Binary genericGetMax() {
-    return max;
-  }
-
-  public Binary getMax() {
-    return max;
-  }
-
-  public Binary getMin() {
-    return min;
-  }
-
-  public void setMinMax(Binary min, Binary max) {
-    this.max = max;
-    this.min = min;
-    this.markAsNotEmpty();
-  }
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/statistics/BooleanStatistics.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/statistics/BooleanStatistics.java b/parquet-column/src/main/java/parquet/column/statistics/BooleanStatistics.java
deleted file mode 100644
index 663dc8d..0000000
--- a/parquet-column/src/main/java/parquet/column/statistics/BooleanStatistics.java
+++ /dev/null
@@ -1,108 +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.column.statistics;
-
-import parquet.bytes.BytesUtils;
-
-public class BooleanStatistics extends Statistics<Boolean> {
-
-  private boolean max;
-  private boolean min;
-
-  @Override
-  public void updateStats(boolean value) {
-    if (!this.hasNonNullValue()) {
-      initializeStats(value, value);
-    } else {
-      updateStats(value, value);
-    }
-  }
-
-  @Override
-  public void mergeStatisticsMinMax(Statistics stats) {
-    BooleanStatistics boolStats = (BooleanStatistics)stats;
-    if (!this.hasNonNullValue()) {
-      initializeStats(boolStats.getMin(), boolStats.getMax());
-    } else {
-      updateStats(boolStats.getMin(), boolStats.getMax());
-    }
-  }
-
-  @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
-    max = BytesUtils.bytesToBool(maxBytes);
-    min = BytesUtils.bytesToBool(minBytes);
-    this.markAsNotEmpty();
-  }
-
-  @Override
-  public byte[] getMaxBytes() {
-    return BytesUtils.booleanToBytes(max);
-  }
-
-  @Override
-  public byte[] getMinBytes() {
-    return BytesUtils.booleanToBytes(min);
-  }
-
-  @Override
-  public String toString() {
-    if (this.hasNonNullValue())
-      return String.format("min: %b, max: %b, num_nulls: %d", min, max, this.getNumNulls());
-    else if(!this.isEmpty())
-      return String.format("num_nulls: %d, min/max not defined", this.getNumNulls());
-    else  
-      return "no stats for this column";
-  }
-
-  public void updateStats(boolean min_value, boolean max_value) {
-    if (min && !min_value) { min = min_value; }
-    if (!max && max_value) { max = max_value; }
-  }
-
-  public void initializeStats(boolean min_value, boolean max_value) {
-      min = min_value;
-      max = max_value;
-      this.markAsNotEmpty();
-  }
-
-  @Override
-  public Boolean genericGetMin() {
-    return min;
-  }
-
-  @Override
-  public Boolean genericGetMax() {
-    return max;
-  }
-
-  public boolean getMax() {
-    return max;
-  }
-
-  public boolean getMin() {
-    return min;
-  }
-
-  public void setMinMax(boolean min, boolean max) {
-    this.max = max;
-    this.min = min;
-    this.markAsNotEmpty();
-  }
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/statistics/DoubleStatistics.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/statistics/DoubleStatistics.java b/parquet-column/src/main/java/parquet/column/statistics/DoubleStatistics.java
deleted file mode 100644
index 8abf466..0000000
--- a/parquet-column/src/main/java/parquet/column/statistics/DoubleStatistics.java
+++ /dev/null
@@ -1,108 +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.column.statistics;
-
-import parquet.bytes.BytesUtils;
-
-public class DoubleStatistics extends Statistics<Double> {
-
-  private double max;
-  private double min;
-
-  @Override
-  public void updateStats(double value) {
-    if (!this.hasNonNullValue()) {
-      initializeStats(value, value);
-    } else {
-      updateStats(value, value);
-    }
-  }
-
-  @Override
-  public void mergeStatisticsMinMax(Statistics stats) {
-    DoubleStatistics doubleStats = (DoubleStatistics)stats;
-    if (!this.hasNonNullValue()) {
-      initializeStats(doubleStats.getMin(), doubleStats.getMax());
-    } else {
-      updateStats(doubleStats.getMin(), doubleStats.getMax());
-    }
-  }
-
-  @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
-    max = Double.longBitsToDouble(BytesUtils.bytesToLong(maxBytes));
-    min = Double.longBitsToDouble(BytesUtils.bytesToLong(minBytes));
-    this.markAsNotEmpty();
-  }
-
-  @Override
-  public byte[] getMaxBytes() {
-    return BytesUtils.longToBytes(Double.doubleToLongBits(max));
-  }
-
-  @Override
-  public byte[] getMinBytes() {
-    return BytesUtils.longToBytes(Double.doubleToLongBits(min));
-  }
-
-  @Override
-  public String toString() {
-    if(this.hasNonNullValue())
-      return String.format("min: %.5f, max: %.5f, num_nulls: %d", min, max, this.getNumNulls());
-    else if (!this.isEmpty())
-      return String.format("num_nulls: %d, min/max not defined", this.getNumNulls());
-    else
-      return "no stats for this column";
-  }
-
-  public void updateStats(double min_value, double max_value) {
-    if (min_value < min) { min = min_value; }
-    if (max_value > max) { max = max_value; }
-  }
-
-  public void initializeStats(double min_value, double max_value) {
-      min = min_value;
-      max = max_value;
-      this.markAsNotEmpty();
-  }
-
-  @Override
-  public Double genericGetMin() {
-    return min;
-  }
-
-  @Override
-  public Double genericGetMax() {
-    return max;
-  }
-
-  public double getMax() {
-    return max;
-  }
-
-  public double getMin() {
-    return min;
-  }
-
-  public void setMinMax(double min, double max) {
-    this.max = max;
-    this.min = min;
-    this.markAsNotEmpty();
-  }
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/statistics/FloatStatistics.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/statistics/FloatStatistics.java b/parquet-column/src/main/java/parquet/column/statistics/FloatStatistics.java
deleted file mode 100644
index 9f1e449..0000000
--- a/parquet-column/src/main/java/parquet/column/statistics/FloatStatistics.java
+++ /dev/null
@@ -1,108 +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.column.statistics;
-
-import parquet.bytes.BytesUtils;
-
-public class FloatStatistics extends Statistics<Float> {
-
-  private float max;
-  private float min;
-
-  @Override
-  public void updateStats(float value) {
-    if (!this.hasNonNullValue()) {
-      initializeStats(value, value);
-    } else {
-      updateStats(value, value);
-    }
-  }
-
-  @Override
-  public void mergeStatisticsMinMax(Statistics stats) {
-    FloatStatistics floatStats = (FloatStatistics)stats;
-    if (!this.hasNonNullValue()) {
-      initializeStats(floatStats.getMin(), floatStats.getMax());
-    } else {
-      updateStats(floatStats.getMin(), floatStats.getMax());
-    }
-  }
-
-  @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
-    max = Float.intBitsToFloat(BytesUtils.bytesToInt(maxBytes));
-    min = Float.intBitsToFloat(BytesUtils.bytesToInt(minBytes));
-    this.markAsNotEmpty();
-  }
-
-  @Override
-  public byte[] getMaxBytes() {
-    return BytesUtils.intToBytes(Float.floatToIntBits(max));
-  }
-
-  @Override
-  public byte[] getMinBytes() {
-    return BytesUtils.intToBytes(Float.floatToIntBits(min));
-  }
-
-  @Override
-  public String toString() {
-    if (this.hasNonNullValue())
-      return String.format("min: %.5f, max: %.5f, num_nulls: %d", min, max, this.getNumNulls());
-    else if (!this.isEmpty())
-      return String.format("num_nulls: %d, min/max not defined", this.getNumNulls());
-    else
-      return "no stats for this column";
-  }
-
-  public void updateStats(float min_value, float max_value) {
-    if (min_value < min) { min = min_value; }
-    if (max_value > max) { max = max_value; }
-  }
-
-  public void initializeStats(float min_value, float max_value) {
-      min = min_value;
-      max = max_value;
-      this.markAsNotEmpty();
-  }
-
-  @Override
-  public Float genericGetMin() {
-    return min;
-  }
-
-  @Override
-  public Float genericGetMax() {
-    return max;
-  }
-
-  public float getMax() {
-    return max;
-  }
-
-  public float getMin() {
-    return min;
-  }
-
-  public void setMinMax(float min, float max) {
-    this.max = max;
-    this.min = min;
-    this.markAsNotEmpty();
-  }
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/statistics/IntStatistics.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/statistics/IntStatistics.java b/parquet-column/src/main/java/parquet/column/statistics/IntStatistics.java
deleted file mode 100644
index eadc563..0000000
--- a/parquet-column/src/main/java/parquet/column/statistics/IntStatistics.java
+++ /dev/null
@@ -1,108 +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.column.statistics;
-
-import parquet.bytes.BytesUtils;
-
-public class IntStatistics extends Statistics<Integer> {
-
-  private int max;
-  private int min;
-
-  @Override
-  public void updateStats(int value) {
-    if (!this.hasNonNullValue()) {
-      initializeStats(value, value);
-    } else {
-      updateStats(value, value);
-    }
-  }
-
-  @Override
-  public void mergeStatisticsMinMax(Statistics stats) {
-    IntStatistics intStats = (IntStatistics)stats;
-    if (!this.hasNonNullValue()) {
-      initializeStats(intStats.getMin(), intStats.getMax());
-    } else {
-      updateStats(intStats.getMin(), intStats.getMax());
-    }
-  }
-
-  @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
-    max = BytesUtils.bytesToInt(maxBytes);
-    min = BytesUtils.bytesToInt(minBytes);
-    this.markAsNotEmpty();
-  }
-
-  @Override
-  public byte[] getMaxBytes() {
-    return BytesUtils.intToBytes(max);
-  }
-
-  @Override
-  public byte[] getMinBytes() {
-    return BytesUtils.intToBytes(min);
-  }
-
-  @Override
-  public String toString() {
-    if (this.hasNonNullValue())
-      return String.format("min: %d, max: %d, num_nulls: %d", min, max, this.getNumNulls());
-    else if (!this.isEmpty())
-      return String.format("num_nulls: %d, min/max is not defined", this.getNumNulls());
-    else
-      return "no stats for this column";
-  }
-
-  public void updateStats(int min_value, int max_value) {
-    if (min_value < min) { min = min_value; }
-    if (max_value > max) { max = max_value; }
-  }
-
-  public void initializeStats(int min_value, int max_value) {
-      min = min_value;
-      max = max_value;
-      this.markAsNotEmpty();
-  }
-
-  @Override
-  public Integer genericGetMin() {
-    return min;
-  }
-
-  @Override
-  public Integer genericGetMax() {
-    return max;
-  }
-
-  public int getMax() {
-    return max;
-  }
-
-  public int getMin() {
-    return min;
-  }
-
-  public void setMinMax(int min, int max) {
-    this.max = max;
-    this.min = min;
-    this.markAsNotEmpty();
-  }
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/statistics/LongStatistics.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/statistics/LongStatistics.java b/parquet-column/src/main/java/parquet/column/statistics/LongStatistics.java
deleted file mode 100644
index 3797566..0000000
--- a/parquet-column/src/main/java/parquet/column/statistics/LongStatistics.java
+++ /dev/null
@@ -1,108 +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.column.statistics;
-
-import parquet.bytes.BytesUtils;
-
-public class LongStatistics extends Statistics<Long> {
-
-  private long max;
-  private long min;
-
-  @Override
-  public void updateStats(long value) {
-    if (!this.hasNonNullValue()) {
-      initializeStats(value, value);
-    } else {
-      updateStats(value, value);
-    }
-  }
-
-  @Override
-  public void mergeStatisticsMinMax(Statistics stats) {
-    LongStatistics longStats = (LongStatistics)stats;
-    if (!this.hasNonNullValue()) {
-      initializeStats(longStats.getMin(), longStats.getMax());
-    } else {
-      updateStats(longStats.getMin(), longStats.getMax());
-    }
-  }
-
-  @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
-    max = BytesUtils.bytesToLong(maxBytes);
-    min = BytesUtils.bytesToLong(minBytes);
-    this.markAsNotEmpty();
-  }
-
-  @Override
-  public byte[] getMaxBytes() {
-    return BytesUtils.longToBytes(max);
-  }
-
-  @Override
-  public byte[] getMinBytes() {
-    return BytesUtils.longToBytes(min);
-  }
-
-  @Override
-  public String toString() {
-    if (this.hasNonNullValue())
-      return String.format("min: %d, max: %d, num_nulls: %d", min, max, this.getNumNulls());
-    else if (!this.isEmpty())
-      return String.format("num_nulls: %d, min/max not defined", this.getNumNulls());
-    else
-      return "no stats for this column";
-  }
-
-  public void updateStats(long min_value, long max_value) {
-    if (min_value < min) { min = min_value; }
-    if (max_value > max) { max = max_value; }
-  }
-
-  public void initializeStats(long min_value, long max_value) {
-      min = min_value;
-      max = max_value;
-      this.markAsNotEmpty();
-  }
-
-  @Override
-  public Long genericGetMin() {
-    return min;
-  }
-
-  @Override
-  public Long genericGetMax() {
-    return max;
-  }
-
-  public long getMax() {
-    return max;
-  }
-
-  public long getMin() {
-    return min;
-  }
-
-  public void setMinMax(long min, long max) {
-    this.max = max;
-    this.min = min;
-    this.markAsNotEmpty();
-  }
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/statistics/Statistics.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/statistics/Statistics.java b/parquet-column/src/main/java/parquet/column/statistics/Statistics.java
deleted file mode 100644
index 107f384..0000000
--- a/parquet-column/src/main/java/parquet/column/statistics/Statistics.java
+++ /dev/null
@@ -1,247 +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.column.statistics;
-
-import parquet.column.UnknownColumnTypeException;
-import parquet.io.api.Binary;
-import parquet.schema.PrimitiveType.PrimitiveTypeName;
-import java.util.Arrays;
-
-
-/**
- * Statistics class to keep track of statistics in parquet pages and column chunks
- *
- * @author Katya Gonina
- */
-public abstract class Statistics<T extends Comparable<T>> {
-
-  private boolean hasNonNullValue;
-  private long num_nulls;
-
-  public Statistics() {
-    hasNonNullValue = false;
-    num_nulls = 0;
-  }
-
-  /**
-   * Returns the typed statistics object based on the passed type parameter
-   * @param type PrimitiveTypeName type of the column
-   * @return instance of a typed statistics class
-   */
-  public static Statistics getStatsBasedOnType(PrimitiveTypeName type) {
-    switch(type) {
-    case INT32:
-      return new IntStatistics();
-    case INT64:
-      return new LongStatistics();
-    case FLOAT:
-      return new FloatStatistics();
-    case DOUBLE:
-      return new DoubleStatistics();
-    case BOOLEAN:
-      return new BooleanStatistics();
-    case BINARY:
-      return new BinaryStatistics();
-    case INT96:
-      return new BinaryStatistics();
-    case FIXED_LEN_BYTE_ARRAY:
-      return new BinaryStatistics();
-    default:
-      throw new UnknownColumnTypeException(type);
-    }
-  }
-
-  /**
-   * updates statistics min and max using the passed value
-   * @param value value to use to update min and max
-   */
-  public void updateStats(int value) {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * updates statistics min and max using the passed value
-   * @param value value to use to update min and max
-   */
-  public void updateStats(long value) {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * updates statistics min and max using the passed value
-   * @param value value to use to update min and max
-   */
-  public void updateStats(float value) {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * updates statistics min and max using the passed value
-   * @param value value to use to update min and max
-   */
-  public void updateStats(double value) {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * updates statistics min and max using the passed value
-   * @param value value to use to update min and max
-   */
-  public void updateStats(boolean value) {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * updates statistics min and max using the passed value
-   * @param value value to use to update min and max
-   */
-  public void updateStats(Binary value) {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * Equality comparison method to compare two statistics objects.
-   * @param stats Statistics object to compare against
-   * @return true if objects are equal, false otherwise
-   */
-  public boolean equals(Statistics stats) {
-    return Arrays.equals(stats.getMaxBytes(), this.getMaxBytes()) &&
-           Arrays.equals(stats.getMinBytes(), this.getMinBytes()) &&
-           stats.getNumNulls() == this.getNumNulls();
-  }
-
-  /**
-   * Hash code for the statistics object
-   * @return hash code int
-   */
-  public int hashCode() {
-    return 31 * Arrays.hashCode(getMaxBytes()) + 17 * Arrays.hashCode(getMinBytes()) + Long.valueOf(this.getNumNulls()).hashCode();
-  }
-
-  /**
-   * Method to merge this statistics object with the object passed
-   * as parameter. Merging keeps the smallest of min values, largest of max
-   * values and combines the number of null counts.
-   * @param stats Statistics object to merge with
-   */
-  public void mergeStatistics(Statistics stats) {
-    if (stats.isEmpty()) return;
-
-    if (this.getClass() == stats.getClass()) {
-      incrementNumNulls(stats.getNumNulls());
-      if (stats.hasNonNullValue()) {
-        mergeStatisticsMinMax(stats);
-        markAsNotEmpty();
-      }
-    } else {
-      throw new StatisticsClassException(this.getClass().toString(), stats.getClass().toString());
-    }
-  }
-
-  /**
-   * Abstract method to merge this statistics min and max with the values
-   * of the parameter object. Does not do any checks, only called internally.
-   * @param stats Statistics object to merge with
-   */
-  abstract protected void mergeStatisticsMinMax(Statistics stats);
-
-  /**
-   * Abstract method to set min and max values from byte arrays.
-   * @param minBytes byte array to set the min value to
-   * @param maxBytes byte array to set the max value to
-   */
-  abstract public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes);
-
-  abstract public T genericGetMin();
-  abstract public T genericGetMax();
-
-  /**
-   * Abstract method to return the max value as a byte array
-   * @return byte array corresponding to the max value
-   */
-  abstract public byte[] getMaxBytes();
-
-  /**
-   * Abstract method to return the min value as a byte array
-   * @return byte array corresponding to the min value
-   */
-  abstract public byte[] getMinBytes();
-
-  /**
-   * toString() to display min, max, num_nulls in a string
-   */
-  abstract public String toString();
-
-
-  /**
-   * Increments the null count by one
-   */
-  public void incrementNumNulls() {
-    num_nulls++ ;
-  }
-
-  /**
-   * Increments the null count by the parameter value
-   * @param increment value to increment the null count by
-   */
-  public void incrementNumNulls(long increment) {
-    num_nulls += increment ;
-  }
-
-  /**
-   * Returns the null count
-   * @return null count
-   */
-  public long getNumNulls() {
-    return num_nulls;
-  }
-
-  /**
-   * Sets the number of nulls to the parameter value
-   * @param nulls null count to set the count to
-   */
-  public void setNumNulls(long nulls) {
-    num_nulls = nulls;
-  }
-
-  /**
-   * Returns a boolean specifying if the Statistics object is empty,
-   * i.e does not contain valid statistics for the page/column yet
-   * @return true if object is empty, false otherwise
-   */
-  public boolean isEmpty() {
-    return !hasNonNullValue && num_nulls == 0;
-  }
-
-  /**
-   * Returns whether there have been non-null values added to this statistics
-   */
-  public boolean hasNonNullValue() {
-    return hasNonNullValue;
-  }
- 
-  /**
-   * Sets the page/column as having a valid non-null value
-   * kind of misnomer here
-   */ 
-  protected void markAsNotEmpty() {
-    hasNonNullValue = true;
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/statistics/StatisticsClassException.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/statistics/StatisticsClassException.java b/parquet-column/src/main/java/parquet/column/statistics/StatisticsClassException.java
deleted file mode 100644
index 64b2d24..0000000
--- a/parquet-column/src/main/java/parquet/column/statistics/StatisticsClassException.java
+++ /dev/null
@@ -1,34 +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.column.statistics;
-
-import parquet.ParquetRuntimeException;
-
-/**
- * Thrown if the two Statistics objects have mismatching types
- *
- * @author  Katya Gonina
- */
-public class StatisticsClassException extends ParquetRuntimeException {
-  private static final long serialVersionUID = 1L;
-
-  public StatisticsClassException(String className1, String className2) {
-    super("Statistics classes mismatched: " + className1 + " vs. " + className2);
-  }
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/values/RequiresFallback.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/values/RequiresFallback.java b/parquet-column/src/main/java/parquet/column/values/RequiresFallback.java
deleted file mode 100644
index 62a35bb..0000000
--- a/parquet-column/src/main/java/parquet/column/values/RequiresFallback.java
+++ /dev/null
@@ -1,54 +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.column.values;
-
-import parquet.column.values.fallback.FallbackValuesWriter;
-
-/**
- *
- * Used to add extra behavior to a ValuesWriter that requires fallback
- * @See {@link FallbackValuesWriter}
- *
- * @author Julien Le Dem
- *
- */
-public interface RequiresFallback {
-
-  /**
-   * In the case of a dictionary based encoding we will fallback if the dictionary becomes too big
-   * @return true to notify the parent that we should fallback to another encoding
-   */
-  boolean shouldFallBack();
-
-  /**
-   * Before writing the first page we will verify if the encoding is worth it.
-   * and fall back if a simpler encoding would be better in that case
-   * @param rawSize the size if encoded with plain
-   * @param encodedSize the size as encoded by the current encoding
-   * @return true if we keep this encoding
-   */
-  boolean isCompressionSatisfying(long rawSize, long encodedSize);
-
-  /**
-   * When falling back to a different encoding we must re-encode all the values seen so far
-   * @param writer the new encoder to write the current values to
-   */
-  void fallBackAllValuesTo(ValuesWriter writer);
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/values/ValuesReader.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/values/ValuesReader.java b/parquet-column/src/main/java/parquet/column/values/ValuesReader.java
deleted file mode 100644
index 9aed6e0..0000000
--- a/parquet-column/src/main/java/parquet/column/values/ValuesReader.java
+++ /dev/null
@@ -1,126 +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.column.values;
-
-import java.io.IOException;
-
-import parquet.io.ParquetDecodingException;
-import parquet.io.api.Binary;
-
-/**
- * Base class to implement an encoding for a given column type.
- *
- * A ValuesReader is provided with a page (byte-array) and is responsible
- * for deserializing the primitive values stored in that page.
- *
- * Given that pages are homogeneous (store only a single type), typical subclasses
- * will only override one of the read*() methods.
- *
- * @author Julien Le Dem
- */
-public abstract class ValuesReader {
-
-  /**
-   * Called to initialize the column reader from a part of a page.
-   *
-   * The underlying implementation knows how much data to read, so a length
-   * is not provided.
-   *
-   * Each page may contain several sections:
-   * <ul>
-   *  <li> repetition levels column
-   *  <li> definition levels column
-   *  <li> data column
-   * </ul>
-   *
-   * This function is called with 'offset' pointing to the beginning of one of these sections,
-   * and should return the offset to the section following it.
-   *
-   * @param valueCount count of values in this page
-   * @param page the array to read from containing the page data (repetition levels, definition levels, data)
-   * @param offset where to start reading from in the page
-   *
-   * @throws IOException
-   */
-  public abstract void initFromPage(int valueCount, byte[] page, int offset) throws IOException;
-  
-  /**
-   * Called to return offset of the next section
-   * @return offset of the next section
-   */
-  public int getNextOffset() {
-    throw new ParquetDecodingException("Unsupported: cannot get offset of the next section.");
-  }
-
-  /**
-   * usable when the encoding is dictionary based
-   * @return the id of the next value from the page
-   */
-  public int readValueDictionaryId() {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * @return the next boolean from the page
-   */
-  public boolean readBoolean() {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * @return the next Binary from the page
-   */
-  public Binary readBytes() {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * @return the next float from the page
-   */
-  public float readFloat() {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * @return the next double from the page
-   */
-  public double readDouble() {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * @return the next integer from the page
-   */
-  public int readInteger() {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * @return the next long from the page
-   */
-  public long readLong() {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * Skips the next value in the page
-   */
-  abstract public void skip();
-}
-

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/values/ValuesWriter.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/values/ValuesWriter.java b/parquet-column/src/main/java/parquet/column/values/ValuesWriter.java
deleted file mode 100644
index a1cd6d1..0000000
--- a/parquet-column/src/main/java/parquet/column/values/ValuesWriter.java
+++ /dev/null
@@ -1,128 +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.column.values;
-
-import parquet.bytes.BytesInput;
-import parquet.column.Encoding;
-import parquet.column.page.DictionaryPage;
-import parquet.io.api.Binary;
-
-/**
- * base class to implement an encoding for a given column
- *
- * @author Julien Le Dem
- *
- */
-public abstract class ValuesWriter {
-
-  /**
-   * used to decide if we want to work to the next page
-   * @return the size of the currently buffered data (in bytes)
-   */
-  public abstract long getBufferedSize();
-
-
-  // TODO: maybe consolidate into a getPage
-  /**
-   * @return the bytes buffered so far to write to the current page
-   */
-  public abstract BytesInput getBytes();
-
-  /**
-   * called after getBytes() and before reset()
-   * @return the encoding that was used to encode the bytes
-   */
-  public abstract Encoding getEncoding();
-
-  /**
-   * called after getBytes() to reset the current buffer and start writing the next page
-   */
-  public abstract void reset();
-
-  /**
-   * @return the dictionary page or null if not dictionary based
-   */
-  public DictionaryPage createDictionaryPage() {
-    return null;
-  }
-
-  /**
-   * reset the dictionary when a new block starts
-   */
-  public void resetDictionary() {
-  }
-
-  /**
-   * ( > {@link #getBufferedMemorySize} )
-   * @return the allocated size of the buffer
-   */
-  abstract public long getAllocatedSize();
-
-  /**
-   * @param value the value to encode
-   */
-  public void writeByte(int value) {
-    throw new UnsupportedOperationException(getClass().getName());
-  }
-
-  /**
-   * @param value the value to encode
-   */
-  public void writeBoolean(boolean v) {
-    throw new UnsupportedOperationException(getClass().getName());
-  }
-
-  /**
-   * @param value the value to encode
-   */
-  public void writeBytes(Binary v) {
-    throw new UnsupportedOperationException(getClass().getName());
-  }
-
-  /**
-   * @param value the value to encode
-   */
-  public void writeInteger(int v) {
-    throw new UnsupportedOperationException(getClass().getName());
-  }
-
-  /**
-   * @param value the value to encode
-   */
-  public void writeLong(long v) {
-    throw new UnsupportedOperationException(getClass().getName());
-  }
-
-  /**
-   * @param value the value to encode
-   */
-  public void writeDouble(double v) {
-    throw new UnsupportedOperationException(getClass().getName());
-  }
-
-  /**
-   * @param value the value to encode
-   */
-  public void writeFloat(float v) {
-    throw new UnsupportedOperationException(getClass().getName());
-  }
-
-  abstract public String memUsageString(String prefix);
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/values/bitpacking/BitPackingValuesReader.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/values/bitpacking/BitPackingValuesReader.java b/parquet-column/src/main/java/parquet/column/values/bitpacking/BitPackingValuesReader.java
deleted file mode 100644
index 676031b..0000000
--- a/parquet-column/src/main/java/parquet/column/values/bitpacking/BitPackingValuesReader.java
+++ /dev/null
@@ -1,91 +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.column.values.bitpacking;
-
-import static parquet.bytes.BytesUtils.getWidthFromMaxInt;
-import static parquet.column.values.bitpacking.BitPacking.createBitPackingReader;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-
-import parquet.Log;
-import parquet.bytes.BytesUtils;
-import parquet.column.values.ValuesReader;
-import parquet.column.values.bitpacking.BitPacking.BitPackingReader;
-import parquet.io.ParquetDecodingException;
-
-/**
- * a column reader that packs the ints in the number of bits required based on the maximum size.
- *
- * @author Julien Le Dem
- *
- */
-public class BitPackingValuesReader extends ValuesReader {
-  private static final Log LOG = Log.getLog(BitPackingValuesReader.class);
-
-  private ByteArrayInputStream in;
-  private BitPackingReader bitPackingReader;
-  private final int bitsPerValue;
-  private int nextOffset;
-
-  /**
-   * @param bound the maximum value stored by this column
-   */
-  public BitPackingValuesReader(int bound) {
-    this.bitsPerValue = getWidthFromMaxInt(bound);
-  }
-
-  /**
-   * {@inheritDoc}
-   * @see parquet.column.values.ValuesReader#readInteger()
-   */
-  @Override
-  public int readInteger() {
-    try {
-      return bitPackingReader.read();
-    } catch (IOException e) {
-      throw new ParquetDecodingException(e);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   * @see parquet.column.values.ValuesReader#initFromPage(long, byte[], int)
-   */
-  @Override
-  public void initFromPage(int valueCount, byte[] in, int offset) throws IOException {
-    int effectiveBitLength = valueCount * bitsPerValue;
-    int length = BytesUtils.paddedByteCountFromBits(effectiveBitLength);
-    if (Log.DEBUG) LOG.debug("reading " + length + " bytes for " + valueCount + " values of size " + bitsPerValue + " bits." );
-    this.in = new ByteArrayInputStream(in, offset, length);
-    this.bitPackingReader = createBitPackingReader(bitsPerValue, this.in, valueCount);
-    this.nextOffset = offset + length;
-  }
-  
-  @Override
-  public int getNextOffset() {
-    return nextOffset;
-  }
-
-  @Override
-  public void skip() {
-    readInteger();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/values/bitpacking/BitPackingValuesWriter.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/values/bitpacking/BitPackingValuesWriter.java b/parquet-column/src/main/java/parquet/column/values/bitpacking/BitPackingValuesWriter.java
deleted file mode 100644
index 69175ca..0000000
--- a/parquet-column/src/main/java/parquet/column/values/bitpacking/BitPackingValuesWriter.java
+++ /dev/null
@@ -1,125 +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.column.values.bitpacking;
-
-import static parquet.bytes.BytesUtils.getWidthFromMaxInt;
-import static parquet.column.Encoding.BIT_PACKED;
-import static parquet.column.values.bitpacking.BitPacking.getBitPackingWriter;
-
-import java.io.IOException;
-
-import parquet.bytes.BytesInput;
-import parquet.bytes.CapacityByteArrayOutputStream;
-import parquet.column.Encoding;
-import parquet.column.values.ValuesWriter;
-import parquet.column.values.bitpacking.BitPacking.BitPackingWriter;
-import parquet.io.ParquetEncodingException;
-
-/**
- * a column writer that packs the ints in the number of bits required based on the maximum size.
- *
- * @author Julien Le Dem
- *
- */
-public class BitPackingValuesWriter extends ValuesWriter {
-
-  private CapacityByteArrayOutputStream out;
-  private BitPackingWriter bitPackingWriter;
-  private int bitsPerValue;
-
-  /**
-   * @param bound the maximum value stored by this column
-   * @param pageSize
-   */
-  public BitPackingValuesWriter(int bound, int initialCapacity, int pageSize) {
-    this.bitsPerValue = getWidthFromMaxInt(bound);
-    this.out = new CapacityByteArrayOutputStream(initialCapacity, pageSize);
-    init();
-  }
-
-  private void init() {
-    this.bitPackingWriter = getBitPackingWriter(bitsPerValue, out);
-  }
-
-  /**
-   * {@inheritDoc}
-   * @see parquet.column.values.ValuesWriter#writeInteger(int)
-   */
-  @Override
-  public void writeInteger(int v) {
-    try {
-      bitPackingWriter.write(v);
-    } catch (IOException e) {
-      throw new ParquetEncodingException(e);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   * @see parquet.column.values.ValuesWriter#getBufferedSize()
-   */
-  @Override
-  public long getBufferedSize() {
-    return out.size();
-  }
-
-  /**
-   * {@inheritDoc}
-   * @see parquet.column.values.ValuesWriter#getBytes()
-   */
-  @Override
-  public BytesInput getBytes() {
-    try {
-      this.bitPackingWriter.finish();
-      return BytesInput.from(out);
-    } catch (IOException e) {
-      throw new ParquetEncodingException(e);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   * @see parquet.column.values.ValuesWriter#reset()
-   */
-  @Override
-  public void reset() {
-    out.reset();
-    init();
-  }
-
-  /**
-   * {@inheritDoc}
-   * @see parquet.column.values.ValuesWriter#getAllocatedSize()
-   */
-  @Override
-  public long getAllocatedSize() {
-    return out.getCapacity();
-  }
-
-  @Override
-  public String memUsageString(String prefix) {
-    return out.memUsageString(prefix);
-  }
-
-  @Override
-  public Encoding getEncoding() {
-    return BIT_PACKED;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/values/bitpacking/ByteBitPackingValuesReader.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/values/bitpacking/ByteBitPackingValuesReader.java b/parquet-column/src/main/java/parquet/column/values/bitpacking/ByteBitPackingValuesReader.java
deleted file mode 100644
index a55dc20..0000000
--- a/parquet-column/src/main/java/parquet/column/values/bitpacking/ByteBitPackingValuesReader.java
+++ /dev/null
@@ -1,83 +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.column.values.bitpacking;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-import parquet.Log;
-import parquet.bytes.BytesUtils;
-import parquet.column.values.ValuesReader;
-
-public class ByteBitPackingValuesReader extends ValuesReader {
-  private static final int VALUES_AT_A_TIME = 8; // because we're using unpack8Values()
-
-  private static final Log LOG = Log.getLog(ByteBitPackingValuesReader.class);
-
-  private final int bitWidth;
-  private final BytePacker packer;
-  private final int[] decoded = new int[VALUES_AT_A_TIME];
-  private int decodedPosition = VALUES_AT_A_TIME - 1;
-  private byte[] encoded;
-  private int encodedPos;
-  private int nextOffset;
-
-  public ByteBitPackingValuesReader(int bound, Packer packer) {
-    this.bitWidth = BytesUtils.getWidthFromMaxInt(bound);
-    this.packer = packer.newBytePacker(bitWidth);
-  }
-
-  @Override
-  public int readInteger() {
-    ++ decodedPosition;
-    if (decodedPosition == decoded.length) {
-      if (encodedPos + bitWidth > encoded.length) {
-        packer.unpack8Values(Arrays.copyOfRange(encoded, encodedPos, encodedPos + bitWidth), 0, decoded, 0);
-      } else {
-        packer.unpack8Values(encoded, encodedPos, decoded, 0);
-      }
-      encodedPos += bitWidth;
-      decodedPosition = 0;
-    }
-    return decoded[decodedPosition];
-  }
-
-  @Override
-  public void initFromPage(int valueCount, byte[] page, int offset)
-      throws IOException {
-    int effectiveBitLength = valueCount * bitWidth;
-    int length = BytesUtils.paddedByteCountFromBits(effectiveBitLength); // ceil
-    if (Log.DEBUG) LOG.debug("reading " + length + " bytes for " + valueCount + " values of size " + bitWidth + " bits." );
-    this.encoded = page;
-    this.encodedPos = offset;
-    this.decodedPosition = VALUES_AT_A_TIME - 1;
-    this.nextOffset = offset + length;
-  }
-  
-  @Override
-  public int getNextOffset() {
-    return nextOffset;
-  }
-
-  @Override
-  public void skip() {
-    readInteger();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/values/bitpacking/ByteBitPackingValuesWriter.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/values/bitpacking/ByteBitPackingValuesWriter.java b/parquet-column/src/main/java/parquet/column/values/bitpacking/ByteBitPackingValuesWriter.java
deleted file mode 100644
index a2e94d2..0000000
--- a/parquet-column/src/main/java/parquet/column/values/bitpacking/ByteBitPackingValuesWriter.java
+++ /dev/null
@@ -1,86 +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.column.values.bitpacking;
-
-import static parquet.column.Encoding.BIT_PACKED;
-
-import java.io.IOException;
-
-import parquet.bytes.BytesInput;
-import parquet.bytes.BytesUtils;
-import parquet.column.Encoding;
-import parquet.column.values.ValuesWriter;
-import parquet.io.ParquetEncodingException;
-
-public class ByteBitPackingValuesWriter extends ValuesWriter {
-
-  private final Packer packer;
-  private final int bitWidth;
-  private ByteBasedBitPackingEncoder encoder;
-
-  public ByteBitPackingValuesWriter(int bound, Packer packer) {
-    this.packer = packer;
-    this.bitWidth = BytesUtils.getWidthFromMaxInt(bound);
-    this.encoder = new ByteBasedBitPackingEncoder(bitWidth, packer);
-  }
-
-  @Override
-  public void writeInteger(int v) {
-    try {
-      this.encoder.writeInt(v);
-    } catch (IOException e) {
-      throw new ParquetEncodingException(e);
-    }
-  }
-
-  @Override
-  public Encoding getEncoding() {
-    return BIT_PACKED;
-  }
-
-  @Override
-  public BytesInput getBytes() {
-    try {
-      return encoder.toBytes();
-    } catch (IOException e) {
-      throw new ParquetEncodingException(e);
-    }
-  }
-
-  @Override
-  public void reset() {
-    encoder = new ByteBasedBitPackingEncoder(bitWidth, packer);
-  }
-
-  @Override
-  public long getBufferedSize() {
-    return encoder.getBufferSize();
-  }
-
-  @Override
-  public long getAllocatedSize() {
-    return encoder.getAllocatedSize();
-  }
-
-  @Override
-  public String memUsageString(String prefix) {
-    return encoder.memUsageString(prefix);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/values/boundedint/BitReader.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/values/boundedint/BitReader.java b/parquet-column/src/main/java/parquet/column/values/boundedint/BitReader.java
deleted file mode 100644
index 717a0e6..0000000
--- a/parquet-column/src/main/java/parquet/column/values/boundedint/BitReader.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.column.values.boundedint;
-
-import java.io.IOException;
-
-import parquet.io.ParquetDecodingException;
-
-class BitReader {
-  private int currentByte = 0;
-  private int currentPosition = 8;
-  private byte[] buf;
-  private int currentBufferPosition = 0;
-  private static final int[] byteGetValueMask = new int[8];
-  private static final int[] readMask = new int[32];
-  private int endBufferPosistion;
-
-  static {
-    int currentMask = 1;
-    for (int i = 0; i < byteGetValueMask.length; i++) {
-      byteGetValueMask[i] = currentMask;
-      currentMask <<= 1;
-    }
-    currentMask = 0;
-    for (int i = 0; i < readMask.length; i++) {
-      readMask[i] = currentMask;
-      currentMask <<= 1;
-      currentMask += 1;
-    }
-  }
-
-  /**
-   * Prepare to deserialize bit-packed integers from the given array.
-   * The array is not copied, so must not be mutated during the course of
-   * reading.
-   */
-  public void prepare(byte[] buf, int offset, int length) {
-    this.buf = buf;
-    this.endBufferPosistion = offset + length;
-    currentByte = 0;
-    currentPosition = 8;
-    currentBufferPosition = offset;
-  }
-
-  /**
-   * Extract the given bit index from the given value.
-   */
-  private static boolean extractBit(int val, int bit) {
-    return (val & byteGetValueMask[bit]) != 0;
-  }
-
-  /**
-   * Read an integer from the stream which is represented by a specified
-   * number of bits.
-   * @param bitsPerValue the number of bits used to represent the integer
-   */
-  public int readNBitInteger(int bitsPerValue) {
-    int bits = bitsPerValue + currentPosition;
-    int currentValue = currentByte >>> currentPosition;
-    int toShift = 8 - currentPosition;
-    while (bits >= 8) {
-      currentByte = getNextByte();
-      currentValue |= currentByte << toShift;
-      toShift += 8;
-      bits -= 8;
-    }
-    currentValue &= readMask[bitsPerValue];
-    currentPosition = (bitsPerValue + currentPosition) % 8;
-    return currentValue;
-  }
-
-  private int getNextByte() {
-    if (currentBufferPosition < endBufferPosistion) {
-      return buf[currentBufferPosition++] & 0xFF;
-    }
-    return 0;
-  }
-
-  public boolean readBit() throws IOException {
-    if (currentPosition == 8) {
-      currentByte = getNextByte();
-      currentPosition = 0;
-    }
-    return extractBit(currentByte, currentPosition++);
-  }
-
-  public int readByte() {
-    currentByte |= (getNextByte() << 8);
-    int value = (currentByte >>> currentPosition) & 0xFF;
-    currentByte >>>= 8;
-    return value;
-  }
-
-  public int readUnsignedVarint() throws IOException {
-    int value = 0;
-    int i = 0;
-    int b;
-    while (((b = readByte()) & 0x80) != 0) {
-        value |= (b & 0x7F) << i;
-        i += 7;
-        if (i > 35) {
-            throw new ParquetDecodingException("Variable length quantity is too long");
-        }
-    }
-    return value | (b << i);
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/values/boundedint/BitWriter.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/values/boundedint/BitWriter.java b/parquet-column/src/main/java/parquet/column/values/boundedint/BitWriter.java
deleted file mode 100644
index f2f673d..0000000
--- a/parquet-column/src/main/java/parquet/column/values/boundedint/BitWriter.java
+++ /dev/null
@@ -1,159 +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.column.values.boundedint;
-
-import parquet.Log;
-import parquet.bytes.BytesInput;
-import parquet.bytes.CapacityByteArrayOutputStream;
-
-class BitWriter {
-  private static final Log LOG = Log.getLog(BitWriter.class);
-  private static final boolean DEBUG = false;//Log.DEBUG;
-
-  private CapacityByteArrayOutputStream baos;
-  private int currentByte = 0;
-  private int currentBytePosition = 0;
-  private static final int[] byteToTrueMask = new int[8];
-  private static final int[] byteToFalseMask = new int[8];
-  private boolean finished = false;
-  static {
-    int currentMask = 1;
-    for (int i = 0; i < byteToTrueMask.length; i++) {
-      byteToTrueMask[i] = currentMask;
-      byteToFalseMask[i] = ~currentMask;
-      currentMask <<= 1;
-    }
-  }
-
-  public BitWriter(int initialCapacity, int pageSize) {
-    this.baos = new CapacityByteArrayOutputStream(initialCapacity, pageSize);
-  }
-
-  public void writeBit(boolean bit) {
-    if (DEBUG) LOG.debug("writing: " + (bit ? "1" : "0"));
-    currentByte = setBytePosition(currentByte, currentBytePosition++, bit);
-    if (currentBytePosition == 8) {
-      baos.write(currentByte);
-      if (DEBUG) LOG.debug("to buffer: " + toBinary(currentByte));
-      currentByte = 0;
-      currentBytePosition = 0;
-    }
-  }
-
-  public void writeByte(int val) {
-    if (DEBUG) LOG.debug("writing: " + toBinary(val) + " (" + val + ")");
-    currentByte |= ((val & 0xFF) << currentBytePosition);
-    baos.write(currentByte);
-    if (DEBUG) LOG.debug("to buffer: " + toBinary(currentByte));
-    currentByte >>>= 8;
-  }
-
-  /**
-   * Write the given integer, serialized using the given number of bits.
-   * It is assumed that the integer can be correctly serialized within
-   * the provided bit size.
-   * @param val the value to serialize
-   * @param bitsToWrite the number of bits to use
-   */
-  public void writeNBitInteger(int val, int bitsToWrite) {
-    if (DEBUG) LOG.debug("writing: " + toBinary(val, bitsToWrite) + " (" + val + ")");
-    val <<= currentBytePosition;
-    int upperByte = currentBytePosition + bitsToWrite;
-    currentByte |= val;
-    while (upperByte >= 8) {
-      baos.write(currentByte); //this only writes the lowest byte
-      if (DEBUG) LOG.debug("to buffer: " + toBinary(currentByte));
-      upperByte -= 8;
-      currentByte >>>= 8;
-    }
-    currentBytePosition = (currentBytePosition + bitsToWrite) % 8;
-  }
-
-  private String toBinary(int val, int alignTo) {
-    String result = Integer.toBinaryString(val);
-    while (result.length() < alignTo) {
-      result = "0" + result;
-    }
-    return result;
-  }
-
-  private String toBinary(int val) {
-    return toBinary(val, 8);
-  }
-
-  public BytesInput finish() {
-    if (!finished) {
-      if (currentBytePosition > 0) {
-        baos.write(currentByte);
-        if (DEBUG) LOG.debug("to buffer: " + toBinary(currentByte));
-      }
-    }
-    finished = true;
-    return BytesInput.from(baos);
-  }
-
-  public void reset() {
-    baos.reset();
-    currentByte = 0;
-    currentBytePosition = 0;
-    finished = false;
-  }
-
-  /**
-   * Set or clear the given bit position in the given byte.
-   * @param currentByte the byte to mutate
-   * @param bitOffset the bit to set or clear
-   * @param newBitValue whether to set or clear the bit
-   * @return the mutated byte
-   */
-  private static int setBytePosition(int currentByte, int bitOffset, boolean newBitValue) {
-    if (newBitValue) {
-      currentByte |= byteToTrueMask[bitOffset];
-    } else {
-      currentByte &= byteToFalseMask[bitOffset];
-    }
-    return currentByte;
-  }
-
-  //This assumes you will never give it a negative value
-  public void writeUnsignedVarint(int value) {
-    while ((value & 0xFFFFFF80) != 0L) {
-      writeByte((value & 0x7F) | 0x80);
-      value >>>= 7;
-    }
-    writeByte(value & 0x7F);
-  }
-
-  public int getMemSize() {
-    // baos = 8 bytes
-    // currentByte + currentBytePosition = 8 bytes
-    // the size of baos:
-    //   count : 4 bytes (rounded to 8)
-    //   buf : 12 bytes (8 ptr + 4 length) should technically be rounded to 8 depending on buffer size
-    return 32 + (int)baos.size();
-  }
-
-  public int getCapacity() {
-    return baos.getCapacity();
-  }
-
-  public String memUsageString(String prefix) {
-    return baos.memUsageString(prefix);
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/b10870e4/parquet-column/src/main/java/parquet/column/values/boundedint/BoundedIntValuesFactory.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/column/values/boundedint/BoundedIntValuesFactory.java b/parquet-column/src/main/java/parquet/column/values/boundedint/BoundedIntValuesFactory.java
deleted file mode 100644
index 9bdc138..0000000
--- a/parquet-column/src/main/java/parquet/column/values/boundedint/BoundedIntValuesFactory.java
+++ /dev/null
@@ -1,32 +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.column.values.boundedint;
-
-import parquet.column.values.ValuesReader;
-import parquet.column.values.ValuesWriter;
-
-public abstract class BoundedIntValuesFactory {
-  public static ValuesReader getBoundedReader(int bound) {
-    return bound == 0 ? new ZeroIntegerValuesReader() : new BoundedIntValuesReader(bound);
-  }
-
-  public static ValuesWriter getBoundedWriter(int bound, int initialCapacity, int pageSize) {
-    return bound == 0 ? new DevNullValuesWriter() : new BoundedIntValuesWriter(bound, initialCapacity, pageSize);
-  }
-}


Mime
View raw message