Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ public void get(int index, NullableFixedSizeBinaryHolder holder) {
*/
@Override
public byte[] getObject(int index) {
return get(index);
if (isSet(index) == 0) {
return null;
}
return get(valueBuffer, index, byteWidth);
}

public int getByteWidth() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.arrow.vector;

import static org.apache.arrow.vector.NullCheckingForGet.NULL_CHECKING_ENABLED;

import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.memory.ReusableBuffer;
import org.apache.arrow.vector.complex.impl.LargeVarBinaryReaderImpl;
Expand Down Expand Up @@ -95,7 +97,7 @@ public MinorType getMinorType() {
*/
public byte[] get(int index) {
assert index >= 0;
if (isSet(index) == 0) {
if (NULL_CHECKING_ENABLED && isSet(index) == 0) {
return null;
}
final long startOffset = getStartOffset(index);
Expand Down Expand Up @@ -127,7 +129,14 @@ public void read(int index, ReusableBuffer<?> buffer) {
*/
@Override
public byte[] getObject(int index) {
return get(index);
if (isSet(index) == 0) {
return null;
}
final long startOffset = getStartOffset(index);
final long dataLength = getEndOffset(index) - startOffset;
final byte[] result = new byte[(int) dataLength];
valueBuffer.getBytes(startOffset, result, 0, (int) dataLength);
return result;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public Types.MinorType getMinorType() {
@Override
public byte[] get(int index) {
assert index >= 0;
if (isSet(index) == 0) {
if (NULL_CHECKING_ENABLED && isSet(index) == 0) {
return null;
}
final long startOffset = getStartOffset(index);
Expand All @@ -120,7 +120,7 @@ public byte[] get(int index) {
@Override
public Text getObject(int index) {
assert index >= 0;
if (NULL_CHECKING_ENABLED && isSet(index) == 0) {
if (isSet(index) == 0) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public interface ValueVector extends Closeable, Iterable<ValueVector> {
* Get friendly type object from the vector.
*
* @param index index of object to get
* @return friendly type object
* @return friendly type object, null if value is unset
*/
Object getObject(int index);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,15 @@ public void read(int index, ReusableBuffer<?> buffer) {
*/
@Override
public byte[] getObject(int index) {
return get(index);
if (isSet(index) == 0) {
return null;
}

final int startOffset = getStartOffset(index);
final int dataLength = getEndOffset(index) - startOffset;
final byte[] result = new byte[dataLength];
valueBuffer.getBytes(startOffset, result, 0, dataLength);
return result;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public byte[] get(int index) {
@Override
public Text getObject(int index) {
assert index >= 0;
if (NULL_CHECKING_ENABLED && isSet(index) == 0) {
if (isSet(index) == 0) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ public void read(int index, ReusableBuffer<?> buffer) {
*/
@Override
public byte[] getObject(int index) {
return get(index);
if (isSet(index) == 0) {
return null;
}
return getData(index);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public byte[] get(int index) {
@Override
public Text getObject(int index) {
assert index >= 0;
if (NULL_CHECKING_ENABLED && isSet(index) == 0) {
if (isSet(index) == 0) {
return null;
}

Expand Down
Loading