Skip to content

Commit

Permalink
[CARBONDATA-3905] NPE due to null length while querying in Presto
Browse files Browse the repository at this point in the history
Why is this PR needed?
Earlier the implementation of putAllByteArray() in class SliceStreamReader was added with regards to handling of complex string type columns. This method is also called in case of plain string type.
While querying plain string type the lengths may be equal to null. Hence this check has been added.

What changes were proposed in this PR?
Handled the same

Does this PR introduce any user interface change?
No

Is any new testcase added?
No

This closes #4003
  • Loading branch information
akkio-97 authored and ajantha-bhat committed Nov 9, 2020
1 parent bfc9533 commit d850c95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Expand Up @@ -141,8 +141,10 @@ public void putByteArray(int rowId, int count, byte[] value) {

@Override
public void putAllByteArray(byte[] data, int offset, int length) {
super.putAllByteArray(data, offset, length);
int[] lengths = getLengths();
int[] offsets = getOffsets();
if (lengths == null) return;
for (int i = 0; i < lengths.length; i++) {
if (offsets[i] != 0) {
putByteArray(i, offsets[i], lengths[i], data);
Expand Down
Expand Up @@ -141,8 +141,10 @@ public void putByteArray(int rowId, int count, byte[] value) {

@Override
public void putAllByteArray(byte[] data, int offset, int length) {
super.putAllByteArray(data, offset, length);
int[] lengths = getLengths();
int[] offsets = getOffsets();
if (lengths == null) return;
for (int i = 0; i < lengths.length; i++) {
if (offsets[i] != 0) {
putByteArray(i, offsets[i], lengths[i], data);
Expand Down

0 comments on commit d850c95

Please sign in to comment.