phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sama...@apache.org
Subject phoenix git commit: Fix test failure
Date Tue, 08 Nov 2016 20:26:55 GMT
Repository: phoenix
Updated Branches:
  refs/heads/encodecolumns2 045ffcbe2 -> a3ff14a8a


Fix test failure


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

Branch: refs/heads/encodecolumns2
Commit: a3ff14a8a8b25a27d0ab0b2c4158ac18b13cf18c
Parents: 045ffcb
Author: Samarth <samarth.jain@salesforce.com>
Authored: Tue Nov 8 12:26:45 2016 -0800
Committer: Samarth <samarth.jain@salesforce.com>
Committed: Tue Nov 8 12:26:45 2016 -0800

----------------------------------------------------------------------
 .../phoenix/compile/CreateTableCompiler.java    |  2 +-
 .../expression/ArrayColumnExpression.java       | 27 +++++++++++---------
 .../expression/KeyValueColumnExpression.java    |  2 +-
 3 files changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a3ff14a8/phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java
b/phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java
index c986c28..fae53e2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java
@@ -329,7 +329,7 @@ public class CreateTableCompiler {
         @Override
         public Boolean visit(ArrayColumnExpression node) {
             try {
-                this.position = table.getColumnFamily(node.getColumnFamily()).getPColumnForColumnQualifier(node.getEncodedColumnQualifier()).getPosition();
+                this.position = table.getColumnFamily(node.getColumnFamily()).getPColumnForColumnQualifier(node.getPositionInArray()).getPosition();
             } catch (SQLException e) {
                 throw new RuntimeException(e);
             }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a3ff14a8/phoenix-core/src/main/java/org/apache/phoenix/expression/ArrayColumnExpression.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/ArrayColumnExpression.java
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ArrayColumnExpression.java
index f4616da..0b5e5d7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/ArrayColumnExpression.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/ArrayColumnExpression.java
@@ -43,21 +43,21 @@ import org.apache.phoenix.util.SchemaUtil;
  */
 public class ArrayColumnExpression extends KeyValueColumnExpression {
     
-    private int encodedCQ;
-    private String displayName;
+    private int positionInArray;
+    private String arrayColDisplayName;
     
     public ArrayColumnExpression() {
     }
     
     public ArrayColumnExpression(PDatum column, byte[] cf, int encodedCQ) {
         super(column, cf, cf);
-        this.encodedCQ = encodedCQ;
+        this.positionInArray = encodedCQ;
     }
     
     public ArrayColumnExpression(PColumn column, String displayName, boolean encodedColumnName)
{
         super(column, column.getFamilyName().getBytes(), column.getFamilyName().getBytes());
-        this.displayName = SchemaUtil.getColumnDisplayName(column.getFamilyName().getString(),
column.getName().getString());
-        this.encodedCQ = column.getEncodedColumnQualifier();
+        this.arrayColDisplayName = displayName;
+        this.positionInArray = column.getEncodedColumnQualifier();
     }
 
     @Override
@@ -70,20 +70,20 @@ public class ArrayColumnExpression extends KeyValueColumnExpression {
 
         // Given a ptr to the entire array, set ptr to point to a particular element within
that array
         // given the type of an array element (see comments in PDataTypeForArray)
-    	PArrayDataType.positionAtArrayElement(ptr, encodedCQ, PVarbinary.INSTANCE, null);
+    	PArrayDataType.positionAtArrayElement(ptr, positionInArray, PVarbinary.INSTANCE, null);
         return true;
     }
 
     @Override
     public void readFields(DataInput input) throws IOException {
         super.readFields(input);
-        encodedCQ = WritableUtils.readVInt(input);
+        positionInArray = WritableUtils.readVInt(input);
     }
 
     @Override
     public void write(DataOutput output) throws IOException {
         super.write(output);
-        WritableUtils.writeVInt(output, encodedCQ);
+        WritableUtils.writeVInt(output, positionInArray);
     }
     
     public KeyValueColumnExpression getKeyValueExpression() {
@@ -118,16 +118,19 @@ public class ArrayColumnExpression extends KeyValueColumnExpression
{
 			public PDataType getDataType() {
 				return datatype;
 			}
-		}, getColumnFamily(), getEncodedColumnQualifier());
+		}, getColumnFamily(), getPositionInArray());
     }
     
     @Override
     public String toString() {
-        return displayName;
+        if (arrayColDisplayName == null) {
+            arrayColDisplayName = SchemaUtil.getColumnDisplayName(getColumnFamily(), getColumnQualifier());
+        }
+        return arrayColDisplayName;
     }
     
-    public byte[] getEncodedColumnQualifier() {
-        return EncodedColumnsUtil.getEncodedColumnQualifier(encodedCQ);
+    public byte[] getPositionInArray() {
+        return EncodedColumnsUtil.getEncodedColumnQualifier(positionInArray);
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a3ff14a8/phoenix-core/src/main/java/org/apache/phoenix/expression/KeyValueColumnExpression.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/KeyValueColumnExpression.java
b/phoenix-core/src/main/java/org/apache/phoenix/expression/KeyValueColumnExpression.java
index 6170418..5cd7433 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/KeyValueColumnExpression.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/KeyValueColumnExpression.java
@@ -42,7 +42,7 @@ import org.apache.phoenix.util.SchemaUtil;
 public class KeyValueColumnExpression extends ColumnExpression {
     private byte[] cf;
     private byte[] cq;
-    private String displayName; // client-side only. TODO: samarth see what can you do for
encoded column names.
+    private String displayName; // client-side only.
 
     public KeyValueColumnExpression() {
     }


Mime
View raw message