/** * Default implementation. Maybe overridden by exact types. */ @Override public int precision() { return HiveDecimalUtils.getPrecisionForType(typeInfo); }
public static TypeInfo getDecimalTypeForPrimitiveCategories( PrimitiveTypeInfo a, PrimitiveTypeInfo b) { int prec1 = HiveDecimalUtils.getPrecisionForType(a); int prec2 = HiveDecimalUtils.getPrecisionForType(b); int scale1 = HiveDecimalUtils.getScaleForType(a); int scale2 = HiveDecimalUtils.getScaleForType(b); int intPart = Math.max(prec1 - scale1, prec2 - scale2); int decPart = Math.max(scale1, scale2); int prec = Math.min(intPart + decPart, HiveDecimal.MAX_PRECISION); int scale = Math.min(decPart, HiveDecimal.MAX_PRECISION - intPart); return TypeInfoFactory.getDecimalTypeInfo(prec, scale); }
public static DecimalTypeInfo getDecimalTypeForPrimitiveCategory(PrimitiveTypeInfo a) { if (a instanceof DecimalTypeInfo) return (DecimalTypeInfo)a; int prec = HiveDecimalUtils.getPrecisionForType(a); int scale = HiveDecimalUtils.getScaleForType(a); prec = Math.min(prec, HiveDecimal.MAX_PRECISION); scale = Math.min(scale, HiveDecimal.MAX_PRECISION - (prec - scale)); return TypeInfoFactory.getDecimalTypeInfo(prec, scale); } }
private int getPrecisionForType(PrimitiveTypeInfo typeInfo) { if (isFloatFamily(typeInfo.getTypeName())) { return HiveDecimal.MAX_PRECISION; } return HiveDecimalUtils.getPrecisionForType(typeInfo); }
private int getPrecisionForType(PrimitiveTypeInfo typeInfo) { if (isFloatFamily(typeInfo.getTypeName())) { return HiveDecimal.MAX_PRECISION; } return HiveDecimalUtils.getPrecisionForType(typeInfo); }
/** * Default implementation. Maybe overridden by exact types. */ @Override public int precision() { return HiveDecimalUtils.getPrecisionForType(typeInfo); }
/** * Default implementation. Maybe overridden by exact types. */ @Override public int precision() { return HiveDecimalUtils.getPrecisionForType(typeInfo); }
/** * Default implementation. Maybe overridden by exact types. */ @Override public int precision() { return HiveDecimalUtils.getPrecisionForType(typeInfo); }
/** * Default implementation. Maybe overridden by exact types. */ @Override public int precision() { return HiveDecimalUtils.getPrecisionForType(typeInfo); }
public static TypeInfo getDecimalTypeForPrimitiveCategories( PrimitiveTypeInfo a, PrimitiveTypeInfo b) { int prec1 = HiveDecimalUtils.getPrecisionForType(a); int prec2 = HiveDecimalUtils.getPrecisionForType(b); int scale1 = HiveDecimalUtils.getScaleForType(a); int scale2 = HiveDecimalUtils.getScaleForType(b); int intPart = Math.max(prec1 - scale1, prec2 - scale2); int decPart = Math.max(scale1, scale2); int prec = Math.min(intPart + decPart, HiveDecimal.MAX_PRECISION); int scale = Math.min(decPart, HiveDecimal.MAX_PRECISION - intPart); return TypeInfoFactory.getDecimalTypeInfo(prec, scale); }
public static TypeInfo getDecimalTypeForPrimitiveCategories( PrimitiveTypeInfo a, PrimitiveTypeInfo b) { int prec1 = HiveDecimalUtils.getPrecisionForType(a); int prec2 = HiveDecimalUtils.getPrecisionForType(b); int scale1 = HiveDecimalUtils.getScaleForType(a); int scale2 = HiveDecimalUtils.getScaleForType(b); int intPart = Math.max(prec1 - scale1, prec2 - scale2); int decPart = Math.max(scale1, scale2); int prec = Math.min(intPart + decPart, HiveDecimal.MAX_PRECISION); int scale = Math.min(decPart, HiveDecimal.MAX_PRECISION - intPart); return TypeInfoFactory.getDecimalTypeInfo(prec, scale); }
public static TypeInfo getDecimalTypeForPrimitiveCategories( PrimitiveTypeInfo a, PrimitiveTypeInfo b) { int prec1 = HiveDecimalUtils.getPrecisionForType(a); int prec2 = HiveDecimalUtils.getPrecisionForType(b); int scale1 = HiveDecimalUtils.getScaleForType(a); int scale2 = HiveDecimalUtils.getScaleForType(b); int intPart = Math.max(prec1 - scale1, prec2 - scale2); int decPart = Math.max(scale1, scale2); int prec = Math.min(intPart + decPart, HiveDecimal.MAX_PRECISION); int scale = Math.min(decPart, HiveDecimal.MAX_PRECISION - intPart); return TypeInfoFactory.getDecimalTypeInfo(prec, scale); }
public static TypeInfo getDecimalTypeForPrimitiveCategories( PrimitiveTypeInfo a, PrimitiveTypeInfo b) { int prec1 = HiveDecimalUtils.getPrecisionForType(a); int prec2 = HiveDecimalUtils.getPrecisionForType(b); int scale1 = HiveDecimalUtils.getScaleForType(a); int scale2 = HiveDecimalUtils.getScaleForType(b); int intPart = Math.max(prec1 - scale1, prec2 - scale2); int decPart = Math.max(scale1, scale2); int prec = Math.min(intPart + decPart, HiveDecimal.MAX_PRECISION); int scale = Math.min(decPart, HiveDecimal.MAX_PRECISION - intPart); return TypeInfoFactory.getDecimalTypeInfo(prec, scale); }
public static DecimalTypeInfo getDecimalTypeForPrimitiveCategory(PrimitiveTypeInfo a) { if (a instanceof DecimalTypeInfo) return (DecimalTypeInfo)a; int prec = HiveDecimalUtils.getPrecisionForType(a); int scale = HiveDecimalUtils.getScaleForType(a); prec = Math.min(prec, HiveDecimal.MAX_PRECISION); scale = Math.min(scale, HiveDecimal.MAX_PRECISION - (prec - scale)); return TypeInfoFactory.getDecimalTypeInfo(prec, scale); } }
public static DecimalTypeInfo getDecimalTypeForPrimitiveCategory(PrimitiveTypeInfo a) { if (a instanceof DecimalTypeInfo) return (DecimalTypeInfo)a; int prec = HiveDecimalUtils.getPrecisionForType(a); int scale = HiveDecimalUtils.getScaleForType(a); prec = Math.min(prec, HiveDecimal.MAX_PRECISION); scale = Math.min(scale, HiveDecimal.MAX_PRECISION - (prec - scale)); return TypeInfoFactory.getDecimalTypeInfo(prec, scale); } }
public static DecimalTypeInfo getDecimalTypeForPrimitiveCategory(PrimitiveTypeInfo a) { if (a instanceof DecimalTypeInfo) return (DecimalTypeInfo)a; int prec = HiveDecimalUtils.getPrecisionForType(a); int scale = HiveDecimalUtils.getScaleForType(a); prec = Math.min(prec, HiveDecimal.MAX_PRECISION); scale = Math.min(scale, HiveDecimal.MAX_PRECISION - (prec - scale)); return TypeInfoFactory.getDecimalTypeInfo(prec, scale); } }
public static DecimalTypeInfo getDecimalTypeForPrimitiveCategory(PrimitiveTypeInfo a) { if (a instanceof DecimalTypeInfo) return (DecimalTypeInfo)a; int prec = HiveDecimalUtils.getPrecisionForType(a); int scale = HiveDecimalUtils.getScaleForType(a); prec = Math.min(prec, HiveDecimal.MAX_PRECISION); scale = Math.min(scale, HiveDecimal.MAX_PRECISION - (prec - scale)); return TypeInfoFactory.getDecimalTypeInfo(prec, scale); } }
private int getPrecisionForType(PrimitiveTypeInfo typeInfo) { if (isFloatFamily(typeInfo.getTypeName())) { return HiveDecimal.MAX_PRECISION; } return HiveDecimalUtils.getPrecisionForType(typeInfo); }