// Path: hive-dwrf/src/main/java/com/facebook/hive/orc/statistics/DoubleColumnStatistics.java
// public interface DoubleColumnStatistics extends ColumnStatistics {
// 
//   /**
//    * Get the smallest value in the column. Only defined if getNumberOfValues
//    * is non-zero.
//    * @return the minimum
//    */
//   double getMinimum();
// 
//   /**
//    * Get the largest value in the column. Only defined if getNumberOfValues
//    * is non-zero.
//    * @return the maximum
//    */
//   double getMaximum();
// 
//   /**
//    * Get the sum of the values in the column.
//    * @return the sum
//    */
//   double getSum();
// }
// 
// Path: hive-dwrf/src/main/java/com/facebook/hive/orc/statistics/StringColumnStatistics.java
// public interface StringColumnStatistics extends ColumnStatistics {
//   /**
//    * Get the minimum string.
//    * @return the minimum
//    */
//   String getMinimum();
// 
//   /**
//    * Get the maximum string.
//    * @return the maximum
//    */
//   String getMaximum();
// }


import com.facebook.hive.orc.statistics.ColumnStatisticsImpl;
import com.facebook.hive.orc.statistics.DoubleColumnStatistics;
import com.facebook.hive.orc.statistics.IntegerColumnStatistics;
import com.facebook.hive.orc.statistics.StringColumnStatistics;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
  @Test
  public void testDoubleStatisticsMerge() throws Exception {
    ObjectInspector inspector =
        PrimitiveObjectInspectorFactory.javaDoubleObjectInspector;

    ColumnStatisticsImpl stats1 = ColumnStatisticsImpl.create(inspector);
    ColumnStatisticsImpl stats2 = ColumnStatisticsImpl.create(inspector);
    stats1.updateDouble(10.0);
    stats1.updateDouble(100.0);
    stats2.updateDouble(1.0);
    stats2.updateDouble(1000.0);
    stats1.merge(stats2);
    DoubleColumnStatistics typed = (DoubleColumnStatistics) stats1;
    assertEquals(1.0, typed.getMinimum(), 0.001);
    assertEquals(1000.0, typed.getMaximum(), 0.001);
  }

  @Test
  public void testStringStatisticsMerge() throws Exception {
    ObjectInspector inspector =
        PrimitiveObjectInspectorFactory.javaStringObjectInspector;

    ColumnStatisticsImpl stats1 = ColumnStatisticsImpl.create(inspector);
    ColumnStatisticsImpl stats2 = ColumnStatisticsImpl.create(inspector);
    stats1.updateString("bob");
    stats1.updateString("david");
    stats1.updateString("charles");
    stats2.updateString("anne");
    stats2.updateString("erin");
    stats1.merge(stats2);
// Path: hive-dwrf/src/main/java/com/facebook/hive/orc/statistics/DoubleColumnStatistics.java
// public interface DoubleColumnStatistics extends ColumnStatistics {
// 
//   /**
//    * Get the smallest value in the column. Only defined if getNumberOfValues
//    * is non-zero.
//    * @return the minimum
//    */
//   double getMinimum();
// 
//   /**
//    * Get the largest value in the column. Only defined if getNumberOfValues
//    * is non-zero.
//    * @return the maximum
//    */
//   double getMaximum();
// 
//   /**
//    * Get the sum of the values in the column.
//    * @return the sum
//    */
//   double getSum();
// }
// 
// Path: hive-dwrf/src/main/java/com/facebook/hive/orc/statistics/StringColumnStatistics.java
// public interface StringColumnStatistics extends ColumnStatistics {
//   /**
//    * Get the minimum string.
//    * @return the minimum
//    */
//   String getMinimum();
// 
//   /**
//    * Get the maximum string.
//    * @return the maximum
//    */
//   String getMaximum();
// }


// Path: hive-dwrf/src/test/java/com/facebook/hive/orc/TestColumnStatistics.java
import com.facebook.hive.orc.statistics.ColumnStatisticsImpl;
import com.facebook.hive.orc.statistics.DoubleColumnStatistics;
import com.facebook.hive.orc.statistics.IntegerColumnStatistics;
import com.facebook.hive.orc.statistics.StringColumnStatistics;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;

  @Test
  public void testDoubleStatisticsMerge() throws Exception {
    ObjectInspector inspector =
        PrimitiveObjectInspectorFactory.javaDoubleObjectInspector;

    ColumnStatisticsImpl stats1 = ColumnStatisticsImpl.create(inspector);
    ColumnStatisticsImpl stats2 = ColumnStatisticsImpl.create(inspector);
    stats1.updateDouble(10.0);
    stats1.updateDouble(100.0);
    stats2.updateDouble(1.0);
    stats2.updateDouble(1000.0);
    stats1.merge(stats2);
    DoubleColumnStatistics typed = (DoubleColumnStatistics) stats1;
    assertEquals(1.0, typed.getMinimum(), 0.001);
    assertEquals(1000.0, typed.getMaximum(), 0.001);
  }

  @Test
  public void testStringStatisticsMerge() throws Exception {
    ObjectInspector inspector =
        PrimitiveObjectInspectorFactory.javaStringObjectInspector;

    ColumnStatisticsImpl stats1 = ColumnStatisticsImpl.create(inspector);
    ColumnStatisticsImpl stats2 = ColumnStatisticsImpl.create(inspector);
    stats1.updateString("bob");
    stats1.updateString("david");
    stats1.updateString("charles");
    stats2.updateString("anne");
    stats2.updateString("erin");
    stats1.merge(stats2);
    StringColumnStatistics strStats = (StringColumnStatistics) stats1;