@Override protected void func(DecimalColumnVector outV, DoubleColumnVector inV, int i) { HiveDecimalWritable decWritable = outV.vector[i]; // TEMPORARY: In order to avoid a new version of storage-api, do the conversion here... byte[] floatBytes = Float.toString((float) inV.vector[i]).getBytes(); decWritable.setFromBytes(floatBytes, 0, floatBytes.length); if (!decWritable.mutateEnforcePrecisionScale(outV.precision, outV.scale)) { outV.isNull[i] = true; outV.noNulls = false; } }
@Override public void init(ByteArrayRef bytes, int start, int length) { if (bytes == null) { throw new RuntimeException("bytes cannot be null!"); } isNull = false; byte[] recv = new byte[length]; System.arraycopy(bytes.getData(), start, recv, 0, length); data.setFromBytes(recv, 0, length); } }
/** * Initilizes LazyHiveDecimal object by interpreting the input bytes * as a numeric string * * @param bytes * @param start * @param length */ @Override public void init(ByteArrayRef bytes, int start, int length) { // Set the HiveDecimalWritable from bytes without converting to String first for // better performance. data.setFromBytes(bytes.getData(), start, length); if (!data.isSet()) { isNull = true; } else { isNull = !data.mutateEnforcePrecisionScale(precision, scale); } if (isNull) { LOG.debug("Data not in the HiveDecimal data type range so converted to null. Given data is :" + new String(bytes.getData(), start, length, StandardCharsets.UTF_8)); } }
currentHiveDecimalWritable.setFromBytes(bytes, fieldStart, fieldLength, /* trimBlanks */ true); boolean decimalIsNull = !currentHiveDecimalWritable.isSet(); if (!decimalIsNull) {
@Override public void init(ByteArrayRef bytes, int start, int length) { if (bytes == null) { throw new RuntimeException("bytes cannot be null!"); } isNull = false; byte[] recv = new byte[length]; System.arraycopy(bytes.getData(), start, recv, 0, length); data.setFromBytes(recv, 0, length); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { data.setFromBytes(bytes.getData(), start, length); HiveDecimal dec = data.getHiveDecimal(precision, scale); data = dec == null ? null : new HiveDecimalWritable(dec); }
@Override public void init(ByteArrayRef bytes, int start, int length) { data.setFromBytes(bytes.getData(), start, length); HiveDecimal dec = data.getHiveDecimal(precision, scale); data = dec == null ? null : new HiveDecimalWritable(dec); }
@Override public void init(ByteArrayRef bytes, int start, int length) { data.setFromBytes(bytes.getData(), start, length); HiveDecimal dec = data.getHiveDecimal(precision, scale); data = dec == null ? null : new HiveDecimalWritable(dec); }
/** * Initilizes LazyHiveDecimal object by interpreting the input bytes * as a numeric string * * @param bytes * @param start * @param length */ @Override public void init(ByteArrayRef bytes, int start, int length) { // Set the HiveDecimalWritable from bytes without converting to String first for // better performance. data.setFromBytes(bytes.getData(), start, length); if (!data.isSet()) { isNull = true; } else { isNull = !data.mutateEnforcePrecisionScale(precision, scale); } if (isNull) { LOG.debug("Data not in the HiveDecimal data type range so converted to null. Given data is :" + new String(bytes.getData(), start, length, StandardCharsets.UTF_8)); } }
currentHiveDecimalWritable.setFromBytes(bytes, fieldStart, fieldLength, /* trimBlanks */ true); boolean decimalIsNull = !currentHiveDecimalWritable.isSet(); if (!decimalIsNull) {
tempHiveDecimalWritable = new HiveDecimalWritable(); tempHiveDecimalWritable.setFromBytes(bytes, saveStart, length);
tempHiveDecimalWritable = new HiveDecimalWritable(); tempHiveDecimalWritable.setFromBytes(bytes, saveStart, length);
tempHiveDecimalWritable = new HiveDecimalWritable(); tempHiveDecimalWritable.setFromBytes(bytes, saveStart, length);