[
https://issues.apache.org/jira/browse/HIVE-18593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16346927#comment-16346927
]
Amruth S commented on HIVE-18593:
---------------------------------
I made the following change to BytesColumnVector#copySelected method.
I am not sure about the behaviour when vector[0] is null, repeating is true
with a non zero length and offset. If someone can point me the behaviour, I can
patch this.
{code:java}
index f914a2248d..7757910a32 100644
---
a/storage-api/src/java/org/apache/hadoop/hive/ql/exec/vector/BytesColumnVector.java
+++
b/storage-api/src/java/org/apache/hadoop/hive/ql/exec/vector/BytesColumnVector.java
@@ -318,7 +318,17 @@ public void copySelected(
// Handle repeating case
if (isRepeating) {
- output.setVal(0, vector[0], start[0], length[0]);
+ final byte[] srcBuffer;
+ if (vector[0] == null) {
+ if (start[0] == 0 && length[0] == 0) {
+ srcBuffer = new byte[0];
+ } else {
+ throw new RuntimeException("isRepeating is true, vector[0] is null but
start[0] is " + start[0] + " and length[0] is " + length[0]);
+ }
+ } else {
+ srcBuffer = vector[0];
+ }
+ output.setVal(0, srcBuffer, start[0], length[0]);
output.isNull[0] = isNull[0];
output.isRepeating = true;
return;
{code}
> NPE on vectorization group by
> -----------------------------
>
> Key: HIVE-18593
> URL: https://issues.apache.org/jira/browse/HIVE-18593
> Project: Hive
> Issue Type: Bug
> Components: Hive, HiveServer2
> Affects Versions: 2.3.2
> Reporter: Amruth S
> Priority: Major
>
> Vectorisation with some queries seem to be failing with null pointer
> exceptions. This happens only with 2.3.2 release and not the older ones.
> In the case, (in BytesColumnVector.java, vector[0] is null, isRepeating is
> true, length[0] is 0, start[0] is 0
> {code:java}
> public void copySelected(
> boolean selectedInUse, int[] sel, int size, BytesColumnVector output) {
> // Output has nulls if and only if input has nulls.
> output.noNulls = noNulls;
> output.isRepeating = false;
> // Handle repeating case
> if (isRepeating) {
> output.setVal(0, vector[0], start[0], length[0]);
> output.isNull[0] = isNull[0];
> output.isRepeating = true;
> return;
> }
> {code}
> Exception trace below
> {code:java}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime
> Error while processing row
> at
> org.apache.hadoop.hive.ql.exec.vector.VectorMapOperator.process(VectorMapOperator.java:883)
> at
> org.apache.hadoop.hive.ql.exec.tez.MapRecordSource.processRow(MapRecordSource.java:86)
> ... 17 more
> Caused by: java.lang.NullPointerException
> at java.lang.System.arraycopy(Native Method)
> at
> org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector.setVal(BytesColumnVector.java:173)
> at
> org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector.copySelected(BytesColumnVector.java:321)
> at
> org.apache.hadoop.hive.ql.exec.vector.expressions.IfExprStringGroupColumnStringGroupColumn.evaluate(IfExprStringGroupColumnStringGroupColumn.java:85)
> at
> org.apache.hadoop.hive.ql.exec.vector.expressions.aggregates.gen.VectorUDAFMaxString.aggregateInputSelection(VectorUDAFMaxString.java:135)
> at
> org.apache.hadoop.hive.ql.exec.vector.VectorGroupByOperator$ProcessingModeBase.processAggregators(VectorGroupByOperator.java:218)
> at
> org.apache.hadoop.hive.ql.exec.vector.VectorGroupByOperator$ProcessingModeHashAggregate.doProcessBatch(VectorGroupByOperator.java:408)
> at
> org.apache.hadoop.hive.ql.exec.vector.VectorGroupByOperator$ProcessingModeBase.processBatch(VectorGroupByOperator.java:179)
> at
> org.apache.hadoop.hive.ql.exec.vector.VectorGroupByOperator.process(VectorGroupByOperator.java:1021)
> at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:897)
> at
> org.apache.hadoop.hive.ql.exec.vector.VectorSelectOperator.process(VectorSelectOperator.java:137)
> at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:897)
> at
> org.apache.hadoop.hive.ql.exec.vector.VectorFilterOperator.process(VectorFilterOperator.java:123)
> at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:897)
> at
> org.apache.hadoop.hive.ql.exec.TableScanOperator.process(TableScanOperator.java:130)
> at
> org.apache.hadoop.hive.ql.exec.vector.VectorMapOperator.process(VectorMapOperator.java:783)
> ... 18 more
> {code}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)