You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jc...@apache.org on 2018/09/07 00:12:37 UTC
hive git commit: HIVE-16480: Empty vector batches of floats or
doubles gets EOFException (Owen O'Malley via Jesus Camacho Rodriguez)
Repository: hive
Updated Branches:
refs/heads/branch-2.1 f9bd36004 -> 292a98f67
HIVE-16480: Empty vector batches of floats or doubles gets EOFException (Owen O'Malley via Jesus Camacho Rodriguez)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/292a98f6
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/292a98f6
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/292a98f6
Branch: refs/heads/branch-2.1
Commit: 292a98f67ae07f78169e9f5da39671e53cbce0fc
Parents: f9bd360
Author: Owen O'Malley <om...@apache.org>
Authored: Thu Sep 6 17:11:54 2018 -0700
Committer: Jesus Camacho Rodriguez <jc...@apache.org>
Committed: Thu Sep 6 17:12:01 2018 -0700
----------------------------------------------------------------------
.../org/apache/orc/impl/TreeReaderFactory.java | 125 ++++++++++---------
1 file changed, 64 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/292a98f6/orc/src/java/org/apache/orc/impl/TreeReaderFactory.java
----------------------------------------------------------------------
diff --git a/orc/src/java/org/apache/orc/impl/TreeReaderFactory.java b/orc/src/java/org/apache/orc/impl/TreeReaderFactory.java
index 56877d1..aa377fa 100644
--- a/orc/src/java/org/apache/orc/impl/TreeReaderFactory.java
+++ b/orc/src/java/org/apache/orc/impl/TreeReaderFactory.java
@@ -591,40 +591,42 @@ public class TreeReaderFactory {
final boolean hasNulls = !result.noNulls;
boolean allNulls = hasNulls;
- if (hasNulls) {
- // conditions to ensure bounds checks skips
- for (int i = 0; batchSize <= result.isNull.length && i < batchSize; i++) {
- allNulls = allNulls & result.isNull[i];
- }
- if (allNulls) {
- result.vector[0] = Double.NaN;
- result.isRepeating = true;
- } else {
- // some nulls
- result.isRepeating = false;
+ if (batchSize > 0) {
+ if (hasNulls) {
// conditions to ensure bounds checks skips
- for (int i = 0; batchSize <= result.isNull.length
- && batchSize <= result.vector.length && i < batchSize; i++) {
- if (!result.isNull[i]) {
- result.vector[i] = utils.readFloat(stream);
- } else {
- // If the value is not present then set NaN
- result.vector[i] = Double.NaN;
+ for (int i = 0; batchSize <= result.isNull.length && i < batchSize; i++) {
+ allNulls = allNulls & result.isNull[i];
+ }
+ if (allNulls) {
+ result.vector[0] = Double.NaN;
+ result.isRepeating = true;
+ } else {
+ // some nulls
+ result.isRepeating = false;
+ // conditions to ensure bounds checks skips
+ for (int i = 0; batchSize <= result.isNull.length
+ && batchSize <= result.vector.length && i < batchSize; i++) {
+ if (!result.isNull[i]) {
+ result.vector[i] = utils.readFloat(stream);
+ } else {
+ // If the value is not present then set NaN
+ result.vector[i] = Double.NaN;
+ }
}
}
+ } else {
+ // no nulls & > 1 row (check repeating)
+ boolean repeating = (batchSize > 1);
+ final float f1 = utils.readFloat(stream);
+ result.vector[0] = f1;
+ // conditions to ensure bounds checks skips
+ for (int i = 1; i < batchSize && batchSize <= result.vector.length; i++) {
+ final float f2 = utils.readFloat(stream);
+ repeating = repeating && (f1 == f2);
+ result.vector[i] = f2;
+ }
+ result.isRepeating = repeating;
}
- } else {
- // no nulls & > 1 row (check repeating)
- boolean repeating = (batchSize > 1);
- final float f1 = utils.readFloat(stream);
- result.vector[0] = f1;
- // conditions to ensure bounds checks skips
- for (int i = 1; i < batchSize && batchSize <= result.vector.length; i++) {
- final float f2 = utils.readFloat(stream);
- repeating = repeating && (f1 == f2);
- result.vector[i] = f2;
- }
- result.isRepeating = repeating;
}
}
@@ -684,41 +686,42 @@ public class TreeReaderFactory {
final boolean hasNulls = !result.noNulls;
boolean allNulls = hasNulls;
-
- if (hasNulls) {
- // conditions to ensure bounds checks skips
- for (int i = 0; i < batchSize && batchSize <= result.isNull.length; i++) {
- allNulls = allNulls & result.isNull[i];
- }
- if (allNulls) {
- result.vector[0] = Double.NaN;
- result.isRepeating = true;
- } else {
- // some nulls
- result.isRepeating = false;
+ if (batchSize != 0) {
+ if (hasNulls) {
// conditions to ensure bounds checks skips
- for (int i = 0; batchSize <= result.isNull.length
- && batchSize <= result.vector.length && i < batchSize; i++) {
- if (!result.isNull[i]) {
- result.vector[i] = utils.readDouble(stream);
- } else {
- // If the value is not present then set NaN
- result.vector[i] = Double.NaN;
+ for (int i = 0; i < batchSize && batchSize <= result.isNull.length; i++) {
+ allNulls = allNulls & result.isNull[i];
+ }
+ if (allNulls) {
+ result.vector[0] = Double.NaN;
+ result.isRepeating = true;
+ } else {
+ // some nulls
+ result.isRepeating = false;
+ // conditions to ensure bounds checks skips
+ for (int i = 0; batchSize <= result.isNull.length
+ && batchSize <= result.vector.length && i < batchSize; i++) {
+ if (!result.isNull[i]) {
+ result.vector[i] = utils.readDouble(stream);
+ } else {
+ // If the value is not present then set NaN
+ result.vector[i] = Double.NaN;
+ }
}
}
+ } else {
+ // no nulls
+ boolean repeating = (batchSize > 1);
+ final double d1 = utils.readDouble(stream);
+ result.vector[0] = d1;
+ // conditions to ensure bounds checks skips
+ for (int i = 1; i < batchSize && batchSize <= result.vector.length; i++) {
+ final double d2 = utils.readDouble(stream);
+ repeating = repeating && (d1 == d2);
+ result.vector[i] = d2;
+ }
+ result.isRepeating = repeating;
}
- } else {
- // no nulls
- boolean repeating = (batchSize > 1);
- final double d1 = utils.readDouble(stream);
- result.vector[0] = d1;
- // conditions to ensure bounds checks skips
- for (int i = 1; i < batchSize && batchSize <= result.vector.length; i++) {
- final double d2 = utils.readDouble(stream);
- repeating = repeating && (d1 == d2);
- result.vector[i] = d2;
- }
- result.isRepeating = repeating;
}
}