Examples of Decimal128FastBuffer


Examples of org.apache.hive.common.util.Decimal128FastBuffer

    private Decimal128FastBuffer scratch;

    @Before
    public void setUp() throws Exception {
      scratch = new Decimal128FastBuffer();
    }
View Full Code Here

Examples of org.apache.hive.common.util.Decimal128FastBuffer

      partialResult = new Object[2];
      resultCount = new LongWritable();
      resultSum = new HiveDecimalWritable();
      partialResult[0] = resultCount;
      partialResult[1] = resultSum;
      scratch = new Decimal128FastBuffer();

    }
View Full Code Here

Examples of org.apache.hive.common.util.Decimal128FastBuffer

    @Before
    public void setUp() throws Exception {
    }

    private void doTestFastStreamForHiveDecimal(String valueString) {
      Decimal128FastBuffer scratch = new Decimal128FastBuffer();
      BigDecimal value = new BigDecimal(valueString);
      Decimal128 dec = new Decimal128();
      dec.update(value);

      HiveDecimalWritable witness = new HiveDecimalWritable();
      witness.set(HiveDecimal.create(value));

      int bufferUsed = dec.fastSerializeForHiveDecimal(scratch);
      HiveDecimalWritable hdw = new HiveDecimalWritable();
      hdw.set(scratch.getBytes(bufferUsed), dec.getScale());

      HiveDecimal hd = hdw.getHiveDecimal();

      BigDecimal readValue = hd.bigDecimalValue();
View Full Code Here

Examples of org.apache.hive.common.util.Decimal128FastBuffer

    @Test
    @Concurrent(count=4)
    @Repeating(repetition=100)
    public void testHive6594() {
      Decimal128FastBuffer scratch = new Decimal128FastBuffer();
      String[] vs = new String[] {
          "-4033.445769230769",
          "6984454.211097692"};

      Decimal128 d = new Decimal128(0L, (short) 14);
      for (String s:vs) {
        Decimal128 p = new Decimal128(s, (short) 14);
        d.addDestructive(p, (short) (short) 14);
      }

      int bufferUsed = d.fastSerializeForHiveDecimal(scratch);
      HiveDecimalWritable hdw = new HiveDecimalWritable();
      hdw.set(scratch.getBytes(bufferUsed), d.getScale());

      HiveDecimal hd = hdw.getHiveDecimal();

      BigDecimal readValue = hd.bigDecimalValue();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.