phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sama...@apache.org
Subject phoenix git commit: Use key value column expression for storing indexed columns in IndexMaintainer
Date Thu, 29 Sep 2016 00:15:46 GMT
Repository: phoenix
Updated Branches:
  refs/heads/encodecolumns aaecd5a4d -> fcafb67d2


Use key value column expression for storing indexed columns in IndexMaintainer


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

Branch: refs/heads/encodecolumns
Commit: fcafb67d29a94a50b8b088bc46e5d15953f64855
Parents: aaecd5a
Author: Samarth <samarth.jain@salesforce.com>
Authored: Wed Sep 28 17:15:36 2016 -0700
Committer: Samarth <samarth.jain@salesforce.com>
Committed: Wed Sep 28 17:15:36 2016 -0700

----------------------------------------------------------------------
 .../org/apache/phoenix/expression/ArrayColumnExpression.java   | 2 +-
 .../main/java/org/apache/phoenix/index/IndexMaintainer.java    | 6 ++----
 .../src/main/java/org/apache/phoenix/query/QueryConstants.java | 3 +++
 .../src/main/java/org/apache/phoenix/schema/PTableImpl.java    | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fcafb67d/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 7310e59..9690809 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
@@ -62,7 +62,7 @@ public class ArrayColumnExpression extends ColumnExpression {
         this.index = column.getEncodedColumnQualifier() + 1;
         byte[] cf = column.getFamilyName().getBytes();
         byte[] cq = EncodedColumnsUtil.getEncodedColumnQualifier(column);
-        this.arrayExpression = new KeyValueColumnExpression(column, cf, cq);
+        this.arrayExpression = new KeyValueColumnExpression(column, cf, cf);
         this.origKVExpression = new KeyValueColumnExpression(column, displayName, encodedColumnName);
         this.displayName = displayName;
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fcafb67d/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
index a3f2a1b..20a0713 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
@@ -76,7 +76,6 @@ import org.apache.phoenix.schema.PColumn;
 import org.apache.phoenix.schema.PColumnFamily;
 import org.apache.phoenix.schema.PDatum;
 import org.apache.phoenix.schema.PIndexState;
-import org.apache.phoenix.schema.PName;
 import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTable.IndexType;
 import org.apache.phoenix.schema.PTable.StorageScheme;
@@ -99,6 +98,7 @@ import org.apache.phoenix.util.IndexUtil;
 import org.apache.phoenix.util.MetaDataUtil;
 import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.TrustedByteArrayOutputStream;
+import org.apache.tephra.TxConstants;
 
 import com.google.common.base.Predicate;
 import com.google.common.collect.Iterators;
@@ -106,8 +106,6 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 
-import org.apache.tephra.TxConstants;
-
 /**
  * 
  * Class that builds index row key from data row key and current state of
@@ -1329,7 +1327,7 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference>
{
                 }
                 @Override
                 public Void visit(ArrayColumnExpression expression) {
-					KeyValueColumnExpression colExpression = expression.getArrayExpression();
+					KeyValueColumnExpression colExpression = expression.getKeyValueExpression();
 					if (indexedColumns.add(new ColumnReference(colExpression.getColumnFamily(), colExpression.getColumnQualifier())))
{
                 		indexedColumnTypes.add(colExpression.getDataType());
                 	}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fcafb67d/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
index b1733f0..dfc8908 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
@@ -383,5 +383,8 @@ public interface QueryConstants {
     public static final byte[] OFFSET_FAMILY = "f_offset".getBytes();
     public static final byte[] OFFSET_COLUMN = "c_offset".getBytes();
     public static final String LAST_SCAN = "LAST_SCAN";
+    //TODO: samarth we may or may not have to tweak this constant for short/long/int column
qualifer schemes.
+    //Qualifier used for the cell that stores various column values using the storage scheme
StorageScheme#COLUMNS_STORED_IN_SINGLE_CELL
+    //public static final ImmutableBytesPtr SINGLE_CELL_COLUMN_QUALIFIER = new ImmutableBytesPtr(PInteger.INSTANCE.toBytes(ENCODED_CQ_COUNTER_INITIAL_VALUE));

 
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fcafb67d/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
index ed26f17..70927a0 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
@@ -842,7 +842,7 @@ public class PTableImpl implements PTable {
                         for (PColumn column : columns) {
                             maxEncodedColumnQualifier = Math.max(maxEncodedColumnQualifier,
column.getEncodedColumnQualifier());
                         }
-                        byte[][] colValues = new byte[maxEncodedColumnQualifier+1][];
+                        byte[][] colValues = new byte[maxEncodedColumnQualifier+1][]; //TODO:
samarth probably use the min_qualifier as an offset here.
                         for (PColumn column : columns) {
                             colValues[column.getEncodedColumnQualifier()] = columnToValueMap.get(column);
                         }


Mime
View raw message