You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2015/02/27 22:59:27 UTC

[1/2] phoenix git commit: PHOENIX-1686 Data length should be checked in KeyValueSchema.next() and maxOffset should be set correctly by the caller

Repository: phoenix
Updated Branches:
  refs/heads/4.0 c668ce12c -> 6cff3f040


PHOENIX-1686 Data length should be checked in KeyValueSchema.next() and maxOffset should be set correctly by the caller


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f6cd3419
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f6cd3419
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f6cd3419

Branch: refs/heads/4.0
Commit: f6cd34198257247c1e194f942ce1b8420891048f
Parents: 18b0d69
Author: maryannxue <we...@intel.com>
Authored: Fri Feb 27 16:57:22 2015 -0500
Committer: maryannxue <we...@intel.com>
Committed: Fri Feb 27 16:57:22 2015 -0500

----------------------------------------------------------------------
 .../phoenix/expression/ProjectedColumnExpression.java |  2 +-
 .../org/apache/phoenix/schema/KeyValueSchema.java     | 14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f6cd3419/phoenix-core/src/main/java/org/apache/phoenix/expression/ProjectedColumnExpression.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/ProjectedColumnExpression.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/ProjectedColumnExpression.java
index d090203..97d1aff 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/ProjectedColumnExpression.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/ProjectedColumnExpression.java
@@ -106,9 +106,9 @@ public class ProjectedColumnExpression extends ColumnExpression {
         try {
             KeyValueSchema schema = getSchema();
             TupleProjector.decodeProjectedValue(tuple, ptr);
-            int maxOffset = ptr.getOffset() + ptr.getLength();
             bitSet.clear();
             bitSet.or(ptr);
+            int maxOffset = ptr.getOffset() + ptr.getLength() - bitSet.getEstimatedLength();
             schema.iterator(ptr, position, bitSet);
             Boolean hasValue = schema.next(ptr, position, maxOffset, bitSet);
             if (hasValue == null || !hasValue.booleanValue())

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f6cd3419/phoenix-core/src/main/java/org/apache/phoenix/schema/KeyValueSchema.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/KeyValueSchema.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/KeyValueSchema.java
index 595103f..1ab8c86 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/KeyValueSchema.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/KeyValueSchema.java
@@ -22,6 +22,8 @@ import java.util.List;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.io.WritableUtils;
 import org.apache.http.annotation.Immutable;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.expression.Expression;
 import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.schema.types.PDataType;
@@ -203,12 +205,14 @@ public class KeyValueSchema extends ValueSchema {
         ptr.set(ptr.get(), ptr.getOffset() + ptr.getLength(), 0);
         if (!isNull(position, valueSet)) {
             Field field = this.getField(position);
-            if (field.getDataType().isFixedWidth()) {
-                ptr.set(ptr.get(),ptr.getOffset(), field.getByteSize());
-            } else {
-                int length = ByteUtil.vintFromBytes(ptr);
-                ptr.set(ptr.get(),ptr.getOffset(),length);
+            int length = field.getDataType().isFixedWidth() ? 
+                    field.getByteSize() : ByteUtil.vintFromBytes(ptr);
+            if (ptr.getOffset() + length > maxOffset) {
+                throw new RuntimeException(new SQLExceptionInfo.Builder(SQLExceptionCode.ILLEGAL_DATA)
+                    .setMessage("Expected length of at least " + length + " bytes, but had " + (maxOffset
+                                    - ptr.getOffset())).build().buildException());
             }
+            ptr.set(ptr.get(),ptr.getOffset(),length);
             return ptr.getLength() > 0;
         }
         return false;


[2/2] phoenix git commit: Merge branch '4.0' of https://git-wip-us.apache.org/repos/asf/phoenix into 4.0

Posted by ma...@apache.org.
Merge branch '4.0' of https://git-wip-us.apache.org/repos/asf/phoenix into 4.0


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6cff3f04
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6cff3f04
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6cff3f04

Branch: refs/heads/4.0
Commit: 6cff3f0406bb4042084a04ca737d594ab2d5710d
Parents: f6cd341 c668ce1
Author: maryannxue <we...@intel.com>
Authored: Fri Feb 27 16:57:48 2015 -0500
Committer: maryannxue <we...@intel.com>
Committed: Fri Feb 27 16:57:48 2015 -0500

----------------------------------------------------------------------
 .../phoenix/mapreduce/util/ConnectionUtil.java     |  9 +++++++++
 .../mapreduce/util/PhoenixConfigurationUtil.java   | 17 +++++++++++++++++
 .../org/apache/phoenix/pig/PhoenixHBaseLoader.java |  9 ++++++---
 .../apache/phoenix/pig/PhoenixHBaseStorage.java    |  2 ++
 4 files changed, 34 insertions(+), 3 deletions(-)
----------------------------------------------------------------------