phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject phoenix git commit: PHOENIX-3800 NPE when doing UPSERT SELECT into salted tables
Date Fri, 05 May 2017 06:10:02 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 92b951e53 -> 2479b68df


PHOENIX-3800 NPE when doing UPSERT SELECT into salted tables


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 2479b68df1e533b89497883cd04f472d26641019
Parents: 92b951e
Author: Ankit Singhal <ankitsinghal59@gmail.com>
Authored: Fri May 5 11:39:42 2017 +0530
Committer: Ankit Singhal <ankitsinghal59@gmail.com>
Committed: Fri May 5 11:39:42 2017 +0530

----------------------------------------------------------------------
 .../apache/phoenix/end2end/UpsertSelectIT.java  | 21 +++++++++++++++-----
 .../apache/phoenix/compile/UpsertCompiler.java  |  2 +-
 2 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2479b68d/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
index 0a20d47..1c04acb 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
@@ -78,20 +78,31 @@ public class UpsertSelectIT extends BaseClientManagedTimeIT {
     
     @Test
     public void testUpsertSelectWithNoIndex() throws Exception {
-        testUpsertSelect(false);
+        testUpsertSelect(false, false);
     }
     
     @Test
     public void testUpsertSelecWithIndex() throws Exception {
-        testUpsertSelect(true);
+        testUpsertSelect(true, false);
     }
     
-    private void testUpsertSelect(boolean createIndex) throws Exception {
+    @Test
+    public void testUpsertSelecWithIndexWithSalt() throws Exception {
+        testUpsertSelect(true, true);
+    }
+
+    @Test
+    public void testUpsertSelecWithNoIndexWithSalt() throws Exception {
+        testUpsertSelect(false, true);
+    }
+
+    private void testUpsertSelect(boolean createIndex, boolean saltTable) throws Exception
{
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), null, ts-1, getUrl(),
null);
+        byte[][] splits = getDefaultSplits(tenantId);
+        initATableValues(ATABLE_NAME, tenantId, saltTable ? null : splits, null, ts-1, getUrl(),
saltTable ? "salt_buckets = 2" : null);
 
-        ensureTableCreated(getUrl(), CUSTOM_ENTITY_DATA_FULL_NAME, CUSTOM_ENTITY_DATA_FULL_NAME,
ts-1);
+        ensureTableCreated(getUrl(), CUSTOM_ENTITY_DATA_FULL_NAME, CUSTOM_ENTITY_DATA_FULL_NAME,
null, ts-1, saltTable ? "salt_buckets = 2" : null);
         String indexName = "IDX1";
         if (createIndex) {
             Properties props = new Properties();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2479b68d/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
index 2304d83..5559ad7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
@@ -677,7 +677,7 @@ public class UpsertCompiler {
                     for (int i = 0 ; i < projectedExpressions.size(); i++) {
                         // Must make new column if position has changed
                         PColumn column = allColumns.get(allColumnsIndexes[i]);
-                        projectedColumns.add(column.getPosition() == i + posOff ? column
: new PColumnImpl(column, i));
+                        projectedColumns.add(column.getPosition() == i + posOff ? column
: new PColumnImpl(column, i + posOff));
                     }
                     // Build table from projectedColumns
                     // Hack to add default column family to be used on server in case no
value column is projected.


Mime
View raw message