Skip to content

Commit

Permalink
Fixes getUTF8String to support off-heap backed memory
Browse files Browse the repository at this point in the history
  • Loading branch information
Feynman Liang committed Aug 29, 2015
1 parent c5ebc93 commit a967eb8
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,16 @@ public Decimal getDecimal(int ordinal, int precision, int scale) {

@Override
public UTF8String getUTF8String(int ordinal) {
if (isNullAt(ordinal)) return null;
final long offsetAndSize = getLong(ordinal);
final int offset = (int) (offsetAndSize >> 32);
final int size = (int) (offsetAndSize & ((1L << 32) - 1));
return UTF8String.fromAddress(baseObject, baseOffset + offset, size);
if (isNullAt(ordinal)) {
return null;
} else if (baseObject == null) { // off-heap storage
return UTF8String.fromBytes(getBinary(ordinal));
} else {
final long offsetAndSize = getLong(ordinal);
final int offset = (int) (offsetAndSize >> 32);
final int size = (int) (offsetAndSize & ((1L << 32) - 1));
return UTF8String.fromAddress(baseObject, baseOffset + offset, size);
}
}

@Override
Expand Down

0 comments on commit a967eb8

Please sign in to comment.