/** * Set a Decimal64 field from a HiveDecimalWritable. * * This is a FAST version that assumes the caller has checked to make sure the writable * is not null and elementNum is correctly adjusted for isRepeating. And, that the isNull entry * has been set. * * We will check for precision/scale range, so the entry's NULL may get set. * Otherwise, only the output entry fields will be set by this method. * * @param elementNum * @param writable */ public void set(int elementNum, HiveDecimalWritable writable) { scratchHiveDecWritable.set(writable); scratchHiveDecWritable.mutateEnforcePrecisionScale(precision, scale); if (!scratchHiveDecWritable.isSet()) { noNulls = false; isNull[elementNum] = true; } else { vector[elementNum] = scratchHiveDecWritable.serialize64(scale); } }
/** * Set a Decimal64 field from a HiveDecimal. * * This is a FAST version that assumes the caller has checked to make sure the hiveDec * is not null and elementNum is correctly adjusted for isRepeating. And, that the isNull entry * has been set. * * We will check for precision/scale range, so the entry's NULL may get set. * Otherwise, only the output entry fields will be set by this method. * * @param elementNum * @param hiveDec */ public void set(int elementNum, HiveDecimal hiveDec) { scratchHiveDecWritable.set(hiveDec); scratchHiveDecWritable.mutateEnforcePrecisionScale(precision, scale); if (!scratchHiveDecWritable.isSet()) { noNulls = false; isNull[elementNum] = true; } else { vector[elementNum] = scratchHiveDecWritable.serialize64(scale); } }
scratchHiveDecWritable.mutateEnforcePrecisionScale(precision, scale); if (scratchHiveDecWritable.isSet()) { vector[inputElementNum] = scratchHiveDecWritable.serialize64(scale); } else {
new HiveDecimalWritable(hiveDecimal).serialize64(decimal64ColumnScale); arguments[i] = decimal64Scalar; } else {
HiveDecimal hiveDecimal = (HiveDecimal) constDesc.getValue(); final long decimal64Scalar = new HiveDecimalWritable(hiveDecimal).serialize64(scale); inVals[i] = decimal64Scalar;
if (!decimalIsNull) { if (field.dataTypePhysicalVariation == DataTypePhysicalVariation.DECIMAL_64) { currentDecimal64 = currentHiveDecimalWritable.serialize64(scale);
@Override public void updateDecimal(HiveDecimalWritable value) { updateDecimal64(value.serialize64(scale), scale); }
/** * Set a Decimal64 field from a HiveDecimalWritable. * * This is a FAST version that assumes the caller has checked to make sure the writable * is not null and elementNum is correctly adjusted for isRepeating. And, that the isNull entry * has been set. * * We will check for precision/scale range, so the entry's NULL may get set. * Otherwise, only the output entry fields will be set by this method. * * @param elementNum * @param writable */ public void set(int elementNum, HiveDecimalWritable writable) { scratchHiveDecWritable.set(writable); scratchHiveDecWritable.mutateEnforcePrecisionScale(precision, scale); if (!scratchHiveDecWritable.isSet()) { noNulls = false; isNull[elementNum] = true; } else { vector[elementNum] = scratchHiveDecWritable.serialize64(scale); } }
/** * Set a Decimal64 field from a HiveDecimal. * * This is a FAST version that assumes the caller has checked to make sure the hiveDec * is not null and elementNum is correctly adjusted for isRepeating. And, that the isNull entry * has been set. * * We will check for precision/scale range, so the entry's NULL may get set. * Otherwise, only the output entry fields will be set by this method. * * @param elementNum * @param hiveDec */ public void set(int elementNum, HiveDecimal hiveDec) { scratchHiveDecWritable.set(hiveDec); scratchHiveDecWritable.mutateEnforcePrecisionScale(precision, scale); if (!scratchHiveDecWritable.isSet()) { noNulls = false; isNull[elementNum] = true; } else { vector[elementNum] = scratchHiveDecWritable.serialize64(scale); } }
private void writeBatch(DecimalColumnVector vector, int offset, int length) throws IOException { if (vector.isRepeating) { if (vector.noNulls || !vector.isNull[0]) { HiveDecimalWritable value = vector.vector[0]; long lg = value.serialize64(scale); indexStatistics.updateDecimal64(lg, scale); if (createBloomFilter) { bloomFilterUtf8.addLong(lg); } for (int i = 0; i < length; ++i) { valueWriter.write(lg); } } } else { for (int i = 0; i < length; ++i) { if (vector.noNulls || !vector.isNull[i + offset]) { HiveDecimalWritable value = vector.vector[i + offset]; long lg = value.serialize64(scale); valueWriter.write(lg); indexStatistics.updateDecimal64(lg, scale); if (createBloomFilter) { bloomFilterUtf8.addLong(lg); } } } } }
scratchHiveDecWritable.mutateEnforcePrecisionScale(precision, scale); if (scratchHiveDecWritable.isSet()) { vector[inputElementNum] = scratchHiveDecWritable.serialize64(scale); } else {
Decimal64StatisticsImpl(int scale, OrcProto.ColumnStatistics stats) { super(stats); this.scale = scale; OrcProto.DecimalStatistics dec = stats.getDecimalStatistics(); if (dec.hasMaximum()) { maximum = new HiveDecimalWritable(dec.getMaximum()).serialize64(scale); } if (dec.hasMinimum()) { minimum = new HiveDecimalWritable(dec.getMinimum()).serialize64(scale); } if (dec.hasSum()) { hasSum = true; HiveDecimalWritable sumTmp = new HiveDecimalWritable(dec.getSum()); if (sumTmp.getHiveDecimal().integerDigitCount() + scale <= TypeDescription.MAX_DECIMAL64_PRECISION) { hasSum = true; sum = sumTmp.serialize64(scale); return; } } hasSum = false; }
if (!decimalIsNull) { if (field.dataTypePhysicalVariation == DataTypePhysicalVariation.DECIMAL_64) { currentDecimal64 = currentHiveDecimalWritable.serialize64(scale);