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 2016/03/31 15:31:21 UTC

phoenix git commit: PHOENIX-2781 Support multi-tenant secondary index in Calcite-Phoenix

Repository: phoenix
Updated Branches:
  refs/heads/calcite caf1c6ed9 -> 4e32e29a5


PHOENIX-2781 Support multi-tenant secondary index in Calcite-Phoenix


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

Branch: refs/heads/calcite
Commit: 4e32e29a562ee83856e36480b17335f5f9a16ea3
Parents: caf1c6e
Author: maryannxue <ma...@gmail.com>
Authored: Thu Mar 31 09:31:11 2016 -0400
Committer: maryannxue <ma...@gmail.com>
Committed: Thu Mar 31 09:31:11 2016 -0400

----------------------------------------------------------------------
 .../phoenix/calcite/CalciteLocalIndexIT.java     | 19 ++++++++++---------
 .../phoenix/calcite/rel/PhoenixTableScan.java    |  6 +++---
 2 files changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e32e29a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java
index 30ec0bc..90bfc3b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteLocalIndexIT.java
@@ -195,11 +195,11 @@ public class CalciteLocalIndexIT extends BaseCalciteIndexIT {
                 .explainIs("PhoenixToEnumerableConverter\n" +
                            "  PhoenixServerProject(ID=[$1], COL0=[$2], COL1=[CAST($0):INTEGER], COL2=[$3])\n" +
                            "    PhoenixTableScan(table=[[phoenix, IDX_MULTITENANT_TEST_TABLE]], filter=[>(CAST($0):INTEGER, 1000)])\n")
-//                .resultIs(0, new Object[][] {
-//                        {"0999", 1000, 1001, 1002},
-//                        {"1000", 1001, 1002, 1003},
-//                        {"1001", 1002, 1003, 1004},
-//                        {"1002", 1003, 1004, 1005}})
+                .resultIs(0, new Object[][] {
+                        {"0999", 1000, 1001, 1002},
+                        {"1000", 1001, 1002, 1003},
+                        {"1001", 1002, 1003, 1004},
+                        {"1002", 1003, 1004, 1005}})
                 .close();
         
         try {
@@ -222,10 +222,11 @@ public class CalciteLocalIndexIT extends BaseCalciteIndexIT {
                 .explainIs("PhoenixToEnumerableConverter\n" +
                            "  PhoenixServerProject(ID=[$1], COL0=[$2], COL1=[CAST($0):INTEGER], COL2=[$3])\n" +
                            "    PhoenixTableScan(table=[[phoenix, IDX_MULTITENANT_TEST_TABLE]], filter=[<=(CAST($0):INTEGER, 6)])\n")
-//                .resultIs(0, new Object[][] {
-//                        {"0002", 3, 4, 5},
-//                        {"0003", 4, 5, 6},
-//                        {"0004", 5, 6, 7}})
+                .sameResultAsPhoenixStandalone(0)
+                /*.resultIs(0, new Object[][] {
+                        {"0002", 3, 4, 5},
+                        {"0003", 4, 5, 6},
+                        {"0004", 5, 6, 7}})*/
                 .close();
         
         start(props).sql("select id, col0 from " + MULTI_TENANT_VIEW1 + " where col0 >= 1000")

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e32e29a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
index c510e3b..32c7a90 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
@@ -255,7 +255,7 @@ public class PhoenixTableScan extends TableScan implements PhoenixRel {
             if (filter != null && !context.getScanRanges().equals(this.scanRanges)) {
                 dynamicFilter = filterExpr;
             }
-            projectColumnFamilies(context.getScan(), phoenixTable.getTable(), columnRefList);
+            projectColumnFamilies(context.getScan(), phoenixTable.mappedColumns, columnRefList);
             if (implementor.getCurrentContext().forceProject) {
                 TupleProjector tupleProjector = implementor.createTupleProjector();
                 TupleProjector.serializeProjectorIntoScan(context.getScan(), tupleProjector);
@@ -275,10 +275,10 @@ public class PhoenixTableScan extends TableScan implements PhoenixRel {
         }
     }
     
-    private void projectColumnFamilies(Scan scan, PTable table, ImmutableIntList columnRefList) {
+    private void projectColumnFamilies(Scan scan, List<PColumn> mappedColumns, ImmutableIntList columnRefList) {
         scan.getFamilyMap().clear();
         for (Integer index : columnRefList) {
-            PColumn column = table.getColumns().get(index);
+            PColumn column = mappedColumns.get(index);
             PName familyName = column.getFamilyName();
             if (familyName != null) {
                 scan.addFamily(familyName.getBytes());