/** * Return the data in bytes corresponding to this given struct. This is useful specifically in * cases where the data is stored in serialized formats like protobufs or thrift and would need * custom deserializers to be deserialized. * */ public byte[] getBytes() { return bytes.getData(); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { assert (length > -1); data.set(bytes.getData(), start, length); } }
@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.set(recv, 0, length); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { assert (length > -1); data.set(bytes.getData(), start, length); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { data.setFromBytes(bytes.getData(), start, length, vInt, vLong); } }
public void logExceptionMessage(ByteArrayRef bytes, int start, int length, String dataType) { try { if(LOG.isDebugEnabled()) { String byteData = Text.decode(bytes.getData(), start, length); LOG.debug("Data not in the " + dataType + " data type range so converted to null. Given data is :" + byteData, new Exception("For debugging purposes")); } } catch (CharacterCodingException e1) { LOG.debug("Data not in the " + dataType + " data type range so converted to null.", e1); } }
@Override public int hashCode() { return LazyUtils.hashBytes(bytes.getData(), start, length); } }
@Override public int hashCode() { return LazyUtils.hashBytes(bytes.getData(), start, length); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { super.init(bytes, start, length); this.bytes = bytes; this.start = start; this.length = length; assert start >= 0; assert start + length <= bytes.getData().length; }
@Override public void init(ByteArrayRef bytes, int start, int length) { assert (1 == length); data.set(bytes.getData()[start]); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { if (oi.isEscaped()) { byte escapeChar = oi.getEscapeChar(); byte[] inputBytes = bytes.getData(); LazyUtils.copyAndEscapeStringDataToText(inputBytes, start, length, escapeChar, data); } else { // if the data is not escaped, simply copy the data. data.set(bytes.getData(), start, length); } isNull = false; }
@Override public void init(ByteArrayRef bytes, int start, int length) { // re-use existing text member in char writable Text textValue = data.getTextValue(); textValue.set(bytes.getData(), start, length); data.enforceMaxLength(maxLength); }
@Override public void init(ByteArrayRef bytes, int start, int length) { assert (8 == length); data.set(Double.longBitsToDouble(LazyBinaryUtils.byteArrayToLong(bytes .getData(), start))); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { // re-use existing text member in varchar writable Text textValue = data.getTextValue(); textValue.set(bytes.getData(), start, length); data.enforceMaxLength(maxLength); }
@Override public void init(ByteArrayRef bytes, int start, int length) { LazyBinaryUtils.readVLong(bytes.getData(), start, vLong); assert (length == vLong.length); data.set(vLong.value); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { fields = new String(bytes.getData(), start, length).split(DELIMITER_PATTERN); isNull = false; }
@Override public void init(ByteArrayRef bytes, int start, int length) { LazyBinarySerDe.setFromBigIntegerBytesAndScale(bytes.getData(), start, length, data); data.mutateEnforcePrecisionScale(precision, scale); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { LazyBinaryUtils.readVInt(bytes.getData(), start, vInt); assert (length == vInt.length); data.set(vInt.value); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { super.init(bytes, start, length); byte[] recv = new byte[length]; System.arraycopy(bytes.getData(), start, recv, 0, length); byte[] decoded = decodeIfNeeded(recv); // use the original bytes in case decoding should fail decoded = decoded.length > 0 ? decoded : recv; data.set(decoded, 0, decoded.length); }
@Override public void init(ByteArrayRef bytes, int start, int length) { String s = null; try { s = Text.decode(bytes.getData(), start, length); data.set(HiveIntervalDayTime.valueOf(s)); isNull = false; } catch (Exception e) { isNull = true; logExceptionMessage(bytes, start, length, "INTERVAL_DAY_TIME"); } }