Examples of bigDecimalValue()


Examples of org.apache.hadoop.hive.common.type.HiveDecimal.bigDecimalValue()

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

      HiveDecimal hd = hdw.getHiveDecimal();

      BigDecimal readValue = hd.bigDecimalValue();

      Assert.assertEquals(value, readValue);

      // Now test fastUpdate from the same serialized HiveDecimal
      Decimal128 decRead = new Decimal128().fastUpdateFromInternalStorage(
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.bigDecimalValue()

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

      HiveDecimal hd = hdw.getHiveDecimal();

      BigDecimal readValue = hd.bigDecimalValue();

      Assert.assertEquals(d.toBigDecimal().stripTrailingZeros(),
          readValue.stripTrailingZeros());
    }
}
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.bigDecimalValue()

        assertEquals (key, (Long) expected, (Long) arr[0]);
      } else if (arr[0] instanceof HiveDecimalWritable) {
        HiveDecimalWritable hdw = (HiveDecimalWritable) arr[0];
        HiveDecimal hd = hdw.getHiveDecimal();
        Decimal128 d128 = (Decimal128)expected;
        assertEquals (key, d128.toBigDecimal(), hd.bigDecimalValue());
      } else if (arr[0] instanceof HiveDecimal) {
          HiveDecimal hd = (HiveDecimal) arr[0];
          Decimal128 d128 = (Decimal128)expected;
          assertEquals (key, d128.toBigDecimal(), hd.bigDecimalValue());
      } else {
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.bigDecimalValue()

        Decimal128 d128 = (Decimal128)expected;
        assertEquals (key, d128.toBigDecimal(), hd.bigDecimalValue());
      } else if (arr[0] instanceof HiveDecimal) {
          HiveDecimal hd = (HiveDecimal) arr[0];
          Decimal128 d128 = (Decimal128)expected;
          assertEquals (key, d128.toBigDecimal(), hd.bigDecimalValue());
      } else {
        Assert.fail("Unsupported result type: " + arr[0].getClass().getName());
      }
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.bigDecimalValue()

      DecimalColumnVector dcv = (DecimalColumnVector) colVec;
      if (value instanceof HiveDecimal) {
        dcv.vector[i].update(((HiveDecimal) value).bigDecimalValue());
      } else {
        HiveDecimal hd = ((WritableHiveDecimalObjectInspector) outputOI).getPrimitiveJavaObject(value);
        dcv.vector[i].update(hd.bigDecimalValue());
      }
    } else {
      throw new RuntimeException("Unhandled object type " + outputOI.getTypeName());
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.bigDecimalValue()

    HiveDecimal result = RoundUtils.round(inputHD, outputColVector.scale);
    if (result == null) {
      outputColVector.noNulls = false;
      outputColVector.isNull[i] = true;
    } else {
      outputColVector.vector[i].update(result.bigDecimalValue().toPlainString(), outputColVector.scale);
    }
  }

  public static void sign(int i, Decimal128 input, LongColumnVector outputColVector) {
    outputColVector.vector[i] = input.getSignum();
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.bigDecimalValue()

    assertEquals(0, ts.getTime() % 1000);
    for (int nanos : new int[] { 100000, 900000, 999100000, 999900000 }) {
      ts.setNanos(nanos);
      HiveDecimal d = timestampToDecimal(ts);
      assertEquals(ts, TimestampWritable.decimalToTimestamp(d));
      assertEquals(ts, TimestampWritable.doubleToTimestamp(d.bigDecimalValue().doubleValue()));
    }
  }

  @Test
  @Concurrent(count=4)
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.bigDecimalValue()

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

      HiveDecimal hd = hdw.getHiveDecimal();

      BigDecimal readValue = hd.bigDecimalValue();

      assertEquals(value, readValue);

      // Now test fastUpdate from the same serialized HiveDecimal
      Decimal128 decRead = new Decimal128().fastUpdateFromInternalStorage(
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.bigDecimalValue()

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

      HiveDecimal hd = hdw.getHiveDecimal();

      BigDecimal readValue = hd.bigDecimalValue();

      assertEquals(d.toBigDecimal().stripTrailingZeros(),
          readValue.stripTrailingZeros());
    }
}
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.bigDecimalValue()

        resultText.set(numberFormat.format(xFloatValue));
        break;
      case DECIMAL:
        xDecimalValue = ((HiveDecimalObjectInspector) argumentOIs[0])
            .getPrimitiveJavaObject(arguments[0].get());
        resultText.set(numberFormat.format(xDecimalValue.bigDecimalValue()));
        break;
      case BYTE:
      case SHORT:
      case INT:
        xIntValue = ((IntObjectInspector) argumentOIs[0]).get(arguments[0].get());
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.