本文整理了Java中org.apache.hadoop.hive.metastore.api.Decimal.getScale()
方法的一些代码示例,展示了Decimal.getScale()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Decimal.getScale()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Decimal
类名称:Decimal
方法名:getScale
暂无
代码示例来源:origin: prestodb/presto
public static Optional<BigDecimal> fromMetastoreDecimal(@Nullable Decimal decimal)
{
if (decimal == null) {
return Optional.empty();
}
return Optional.of(new BigDecimal(new BigInteger(decimal.getUnscaled()), decimal.getScale()));
}
代码示例来源:origin: apache/hive
public Object getFieldValue(_Fields field) {
switch (field) {
case SCALE:
return getScale();
case UNSCALED:
return getUnscaled();
}
throw new IllegalStateException();
}
代码示例来源:origin: apache/hive
public static double decimalToDouble(Decimal decimal) {
return new BigDecimal(new BigInteger(decimal.getUnscaled()), decimal.getScale()).doubleValue();
}
代码示例来源:origin: apache/hive
public static String createJdoDecimalString(Decimal d) {
return new BigDecimal(new BigInteger(d.getUnscaled()), d.getScale()).toString();
}
}
代码示例来源:origin: apache/hive
private static String convertToString(Decimal val) {
if (val == null) {
return "";
}
HiveDecimal result = HiveDecimal.create(new BigInteger(val.getUnscaled()), val.getScale());
if (result != null) {
return result.toString();
} else {
return "";
}
}
代码示例来源:origin: apache/drill
private static String convertToString(Decimal val) {
if (val == null) {
return "";
}
HiveDecimal result = HiveDecimal.create(new BigInteger(val.getUnscaled()), val.getScale());
if (result != null) {
return result.toString();
} else {
return "";
}
}
代码示例来源:origin: apache/hive
if (highValue != null && highValue.getUnscaled() != null
&& lowValue != null && lowValue.getUnscaled() != null) {
HiveDecimal maxHiveDec = HiveDecimal.create(new BigInteger(highValue.getUnscaled()), highValue.getScale());
BigDecimal maxVal = maxHiveDec == null ? null : maxHiveDec.bigDecimalValue();
HiveDecimal minHiveDec = HiveDecimal.create(new BigInteger(lowValue.getUnscaled()), lowValue.getScale());
BigDecimal minVal = minHiveDec == null ? null : minHiveDec.bigDecimalValue();
代码示例来源:origin: apache/drill
if (highValue != null && highValue.getUnscaled() != null
&& lowValue != null && lowValue.getUnscaled() != null) {
HiveDecimal maxHiveDec = HiveDecimal.create(new BigInteger(highValue.getUnscaled()), highValue.getScale());
BigDecimal maxVal = maxHiveDec == null ? null : maxHiveDec.bigDecimalValue();
HiveDecimal minHiveDec = HiveDecimal.create(new BigInteger(lowValue.getUnscaled()), lowValue.getScale());
BigDecimal minVal = minHiveDec == null ? null : minHiveDec.bigDecimalValue();
代码示例来源:origin: com.facebook.presto.hive/hive-apache
public Object getFieldValue(_Fields field) {
switch (field) {
case UNSCALED:
return getUnscaled();
case SCALE:
return Short.valueOf(getScale());
}
throw new IllegalStateException();
}
代码示例来源:origin: prestosql/presto
public static Optional<BigDecimal> fromMetastoreDecimal(@Nullable Decimal decimal)
{
if (decimal == null) {
return Optional.empty();
}
return Optional.of(new BigDecimal(new BigInteger(decimal.getUnscaled()), decimal.getScale()));
}
代码示例来源:origin: org.apache.hive/hive-standalone-metastore
public static String createJdoDecimalString(Decimal d) {
return new BigDecimal(new BigInteger(d.getUnscaled()), d.getScale()).toString();
}
}
代码示例来源:origin: org.apache.hive/hive-standalone-metastore
public static double decimalToDouble(Decimal decimal) {
return new BigDecimal(new BigInteger(decimal.getUnscaled()), decimal.getScale()).doubleValue();
}
代码示例来源:origin: org.spark-project.hive/hive-metastore
public Object getFieldValue(_Fields field) {
switch (field) {
case UNSCALED:
return getUnscaled();
case SCALE:
return Short.valueOf(getScale());
}
throw new IllegalStateException();
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
private static String createJdoDecimalString(Decimal d) {
return new BigDecimal(new BigInteger(d.getUnscaled()), d.getScale()).toString();
}
代码示例来源:origin: org.spark-project.hive/hive-metastore
private static String createJdoDecimalString(Decimal d) {
return new BigDecimal(new BigInteger(d.getUnscaled()), d.getScale()).toString();
}
代码示例来源:origin: com.alibaba.blink/flink-connector-hive
@VisibleForTesting
protected static Decimal fromHiveDecimal(org.apache.hadoop.hive.metastore.api.Decimal hiveDecimal) {
BigDecimal bigDecimal = new BigDecimal(new BigInteger(hiveDecimal.getUnscaled()), hiveDecimal.getScale());
return Decimal.fromBigDecimal(bigDecimal, bigDecimal.precision(), bigDecimal.scale());
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
private static String convertToString(Decimal val) {
if (val == null) {
return "";
}
return HiveDecimal.create(new BigInteger(val.getUnscaled()), val.getScale()).toString();
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
Decimal val = csd.getDecimalStats().getHighValue();
BigDecimal maxVal = HiveDecimal.
create(new BigInteger(val.getUnscaled()), val.getScale()).bigDecimalValue();
val = csd.getDecimalStats().getLowValue();
BigDecimal minVal = HiveDecimal.
create(new BigInteger(val.getUnscaled()), val.getScale()).bigDecimalValue();
cs.setRange(minVal, maxVal);
} else if (colType.equalsIgnoreCase(serdeConstants.DATE_TYPE_NAME)) {
内容来源于网络,如有侵权,请联系作者删除!