@Override protected int getLength(ObjectInspector objectInspector, ByteArrayRef cachedByteArrayRef, int start, int fieldLen) { if (fieldLen == lengthNullSequence) { byte[] data = cachedByteArrayRef.getData(); if (LazyUtils.compare(data, start, fieldLen, nullSequence.getBytes(), 0, lengthNullSequence) == 0) { return -1; } } return fieldLen; }
protected final boolean isNull( Text nullSequence, byte[] bytes, int fieldByteBegin, int fieldLength) { // Test the length first so in most cases we avoid doing a byte[] // comparison. return fieldLength < 0 || (fieldLength == nullSequence.getLength() && LazyUtils.compare(bytes, fieldByteBegin, fieldLength, nullSequence.getBytes(), 0, nullSequence.getLength()) == 0); }
@Override protected int getLength(ObjectInspector objectInspector, ByteArrayRef cachedByteArrayRef, int start, int fieldLen) { if (fieldLen == lengthNullSequence) { byte[] data = cachedByteArrayRef.getData(); if (LazyUtils.compare(data, start, fieldLen, nullSequence.getBytes(), 0, lengthNullSequence) == 0) { return -1; } } return fieldLen; }
@Override protected int getLength(ObjectInspector objectInspector, ByteArrayRef cachedByteArrayRef, int start, int fieldLen) { if (fieldLen == lengthNullSequence) { byte[] data = cachedByteArrayRef.getData(); if (LazyUtils.compare(data, start, fieldLen, nullSequence.getBytes(), 0, lengthNullSequence) == 0) { return -1; } } return fieldLen; }
@Override protected int getLength(ObjectInspector objectInspector, ByteArrayRef cachedByteArrayRef, int start, int fieldLen) { if (fieldLen == lengthNullSequence) { byte[] data = cachedByteArrayRef.getData(); if (LazyUtils.compare(data, start, fieldLen, nullSequence.getBytes(), 0, lengthNullSequence) == 0) { return -1; } } return fieldLen; }
@Override protected int getLength(ObjectInspector objectInspector, ByteArrayRef cachedByteArrayRef, int start, int fieldLen) { if (fieldLen == lengthNullSequence) { byte[] data = cachedByteArrayRef.getData(); if (LazyUtils.compare(data, start, fieldLen, nullSequence.getBytes(), 0, lengthNullSequence) == 0) { return -1; } } return fieldLen; }
protected final boolean isNull( Text nullSequence, byte[] bytes, int fieldByteBegin, int fieldLength) { // Test the length first so in most cases we avoid doing a byte[] // comparison. return fieldLength < 0 || (fieldLength == nullSequence.getLength() && LazyUtils.compare(bytes, fieldByteBegin, fieldLength, nullSequence.getBytes(), 0, nullSequence.getLength()) == 0); }
protected final boolean isNull( Text nullSequence, byte[] bytes, int fieldByteBegin, int fieldLength) { // Test the length first so in most cases we avoid doing a byte[] // comparison. return fieldLength < 0 || (fieldLength == nullSequence.getLength() && LazyUtils.compare(bytes, fieldByteBegin, fieldLength, nullSequence.getBytes(), 0, nullSequence.getLength()) == 0); }
protected final boolean isNull( Text nullSequence, byte[] bytes, int fieldByteBegin, int fieldLength) { // Test the length first so in most cases we avoid doing a byte[] // comparison. return fieldLength < 0 || (fieldLength == nullSequence.getLength() && LazyUtils.compare(bytes, fieldByteBegin, fieldLength, nullSequence.getBytes(), 0, nullSequence.getLength()) == 0); }
protected final boolean isNull( Text nullSequence, byte[] bytes, int fieldByteBegin, int fieldLength) { // Test the length first so in most cases we avoid doing a byte[] // comparison. return fieldLength < 0 || (fieldLength == nullSequence.getLength() && LazyUtils.compare(bytes, fieldByteBegin, fieldLength, nullSequence.getBytes(), 0, nullSequence.getLength()) == 0); }
/** * Get the field out of the row without checking parsed. * * @return The value of the field */ private Object uncheckedGetField() { Text nullSequence = oi.getNullSequence(); int fieldLength = start + length - startPosition; if (fieldLength != 0 && fieldLength == nullSequence.getLength() && LazyUtils.compare(bytes.getData(), startPosition, fieldLength, nullSequence.getBytes(), 0, nullSequence.getLength()) == 0) { return null; } if (!fieldInited) { fieldInited = true; field.init(bytes, startPosition, fieldLength); } return field.getObject(); }
/** * Get the field out of the row without checking parsed. This is called by * both getField and getFieldsAsList. * * @param fieldID * The id of the field starting from 0. * @param nullSequence * The sequence representing NULL value. * @return The value of the field */ private Object uncheckedGetField(int fieldID) { Text nullSequence = oi.getNullSequence(); // Test the length first so in most cases we avoid doing a byte[] // comparison. int fieldByteBegin = startPosition[fieldID]; int fieldLength = startPosition[fieldID + 1] - startPosition[fieldID] - 1; if ((fieldLength < 0) || (fieldLength == nullSequence.getLength() && LazyUtils.compare(bytes .getData(), fieldByteBegin, fieldLength, nullSequence.getBytes(), 0, nullSequence.getLength()) == 0)) { return null; } if (!fieldInited[fieldID]) { fieldInited[fieldID] = true; fields[fieldID].init(bytes, fieldByteBegin, fieldLength); } return fields[fieldID].getObject(); }
/** * Get the key object with the index without checking parsed. * * @param index * The index into the array starting from 0 */ private LazyPrimitive<?, ?> uncheckedGetKey(int index) { Text nullSequence = oi.getNullSequence(); int keyIBegin = keyStart[index]; int keyILength = keyEnd[index] - keyStart[index]; if (keyILength < 0 || ((keyILength == nullSequence.getLength()) && 0 == LazyUtils.compare( bytes.getData(), keyIBegin, keyILength, nullSequence.getBytes(), 0, nullSequence.getLength()))) { return null; } if (!keyInited[index]) { keyInited[index] = true; if (keyObjects[index] == null) { // Keys are always primitive keyObjects[index] = LazyFactory .createLazyPrimitiveClass((PrimitiveObjectInspector) ((MapObjectInspector) oi) .getMapKeyObjectInspector()); } keyObjects[index].init(bytes, keyIBegin, keyILength); } return keyObjects[index]; }
/** * Get the value object with the index without checking parsed. * * @param index * The index into the array starting from 0 */ private LazyObject uncheckedGetValue(int index) { Text nullSequence = oi.getNullSequence(); int valueIBegin = keyEnd[index] + 1; int valueILength = keyStart[index + 1] - 1 - valueIBegin; if (valueILength < 0 || ((valueILength == nullSequence.getLength()) && 0 == LazyUtils .compare(bytes.getData(), valueIBegin, valueILength, nullSequence .getBytes(), 0, nullSequence.getLength()))) { return null; } if (!valueInited[index]) { valueInited[index] = true; if (valueObjects[index] == null) { valueObjects[index] = LazyFactory .createLazyObject(((MapObjectInspector) oi) .getMapValueObjectInspector()); } valueObjects[index].init(bytes, valueIBegin, valueILength); } return valueObjects[index]; }
/** * Get the element without checking out-of-bound index. */ private Object uncheckedGetElement(int index) { Text nullSequence = oi.getNullSequence(); int elementLength = startPosition[index + 1] - startPosition[index] - 1; if (elementLength == nullSequence.getLength() && 0 == LazyUtils .compare(bytes.getData(), startPosition[index], elementLength, nullSequence.getBytes(), 0, nullSequence.getLength())) { return null; } else { if (!elementInited[index]) { elementInited[index] = true; if (arrayElements[index] == null) { arrayElements[index] = LazyFactory .createLazyObject(((ListObjectInspector) oi) .getListElementObjectInspector()); } arrayElements[index].init(bytes, startPosition[index], elementLength); } } return arrayElements[index].getObject(); }
byte[] data = cachedByteArrayRef.getData(); if (LazyUtils.compare(data, rawBytesField.getStart(), fieldLen, nullSequence.getBytes(), 0, lengthNullSequence) == 0) { return null;