PHOENIX-1646 Views and functional index expressions may lose information when stringified
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2730e874 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2730e874 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2730e874 Branch: refs/heads/calcite Commit: 2730e874d4632e681d2e21d1df88e4516e87e72e Parents: abeaa74 Author: James Taylor <jtay...@salesforce.com> Authored: Tue Feb 10 01:05:06 2015 -0800 Committer: James Taylor <jtay...@salesforce.com> Committed: Tue Feb 10 01:05:06 2015 -0800 ---------------------------------------------------------------------- .../apache/phoenix/end2end/DerivedTableIT.java | 6 ++-- .../org/apache/phoenix/end2end/HashJoinIT.java | 30 ++++++++++---------- .../phoenix/end2end/HashJoinLocalIndexIT.java | 2 +- .../org/apache/phoenix/end2end/SubqueryIT.java | 16 +++++------ .../end2end/SubqueryUsingSortMergeJoinIT.java | 24 ++++++++-------- .../java/org/apache/phoenix/end2end/ViewIT.java | 2 +- .../end2end/index/BaseMutableIndexIT.java | 6 ++-- .../index/GlobalIndexOptimizationIT.java | 4 +-- .../phoenix/end2end/index/LocalIndexIT.java | 4 +-- .../phoenix/compile/IndexStatementRewriter.java | 5 ++-- 10 files changed, 49 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/2730e874/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java index 7a418bd..7443267 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java @@ -92,15 +92,15 @@ public class DerivedTableIT extends BaseClientManagedTimeIT { "CREATE INDEX ATABLE_DERIVED_IDX ON aTable (a_byte) INCLUDE (A_STRING, B_STRING)" }, { "CLIENT PARALLEL 1-WAY FULL SCAN OVER ATABLE_DERIVED_IDX\n" + - " SERVER AGGREGATE INTO DISTINCT ROWS BY [A_STRING, B_STRING]\n" + + " SERVER AGGREGATE INTO DISTINCT ROWS BY [\"A_STRING\", \"B_STRING\"]\n" + "CLIENT MERGE SORT\n" + - "CLIENT SORTED BY [B_STRING]\n" + + "CLIENT SORTED BY [\"B_STRING\"]\n" + "CLIENT SORTED BY [A]\n" + "CLIENT AGGREGATE INTO DISTINCT ROWS BY [A]\n" + "CLIENT SORTED BY [A DESC]", "CLIENT PARALLEL 1-WAY FULL SCAN OVER ATABLE_DERIVED_IDX\n" + - " SERVER AGGREGATE INTO DISTINCT ROWS BY [A_STRING, B_STRING]\n" + + " SERVER AGGREGATE INTO DISTINCT ROWS BY [\"A_STRING\", \"B_STRING\"]\n" + "CLIENT MERGE SORT\n" + "CLIENT AGGREGATE INTO DISTINCT ROWS BY [A]\n" + "CLIENT DISTINCT ON [COLLECTDISTINCT(B)]"}}); http://git-wip-us.apache.org/repos/asf/phoenix/blob/2730e874/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java index 76eab22..5d2f522 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java @@ -478,9 +478,9 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { * GROUP BY i.name ORDER BY i.name */ "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + - " SERVER AGGREGATE INTO DISTINCT ROWS BY [I.0:NAME]\n" + + " SERVER AGGREGATE INTO DISTINCT ROWS BY [\"I.0:NAME\"]\n" + "CLIENT MERGE SORT\n" + - "CLIENT SORTED BY [I.0:NAME]\n" + + "CLIENT SORTED BY [\"I.0:NAME\"]\n" + " PARALLEL LEFT-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SCHEMA + ".idx_item\n" + " SERVER FILTER BY FIRST KEY ONLY", @@ -518,7 +518,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { */ "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SCHEMA + ".idx_item\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY [I.0:NAME]\n" + + " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY [\"I.0:NAME\"]\n" + "CLIENT MERGE SORT\n" + " PARALLEL LEFT-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME, @@ -601,7 +601,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { */ "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SCHEMA + ".idx_item\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER SORTED BY [I1.0:NAME, I2.0:NAME]\n" + + " SERVER SORTED BY [\"I1.0:NAME\", \"I2.0:NAME\"]\n" + "CLIENT MERGE SORT\n" + " PARALLEL INNER-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SCHEMA + ".idx_item", @@ -651,14 +651,14 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { * ORDER BY c.customer_id, i.name */ "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_CUSTOMER_TABLE_DISPLAY_NAME + " [*] - ['0000000005']\n" + - " SERVER SORTED BY [\"C.customer_id\", I.0:NAME]\n" + + " SERVER SORTED BY [\"C.customer_id\", \"I.0:NAME\"]\n" + "CLIENT MERGE SORT\n" + " PARALLEL INNER-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + " SERVER FILTER BY \"order_id\" != '000000000000003'\n" + " PARALLEL INNER-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SCHEMA + ".idx_item\n" + - " SERVER FILTER BY NAME != 'T3'\n" + + " SERVER FILTER BY \"NAME\" != 'T3'\n" + " PARALLEL LEFT-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SUPPLIER_TABLE_DISPLAY_NAME + "\n" + " DYNAMIC SERVER FILTER BY \"customer_id\" IN (\"O.customer_id\")", @@ -750,7 +750,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { " SERVER FILTER BY \"order_id\" != '000000000000003'\n" + " PARALLEL INNER-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SCHEMA + ".idx_item\n" + - " SERVER FILTER BY NAME != 'T3'\n" + + " SERVER FILTER BY \"NAME\" != 'T3'\n" + " PARALLEL LEFT-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SUPPLIER_TABLE_DISPLAY_NAME, /* @@ -845,9 +845,9 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { * GROUP BY i.name ORDER BY i.name */ "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + - " SERVER AGGREGATE INTO DISTINCT ROWS BY [I.0:NAME]\n" + + " SERVER AGGREGATE INTO DISTINCT ROWS BY [\"I.0:NAME\"]\n" + "CLIENT MERGE SORT\n" + - "CLIENT SORTED BY [I.0:NAME]\n" + + "CLIENT SORTED BY [\"I.0:NAME\"]\n" + " PARALLEL LEFT-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX + "" + JOIN_ITEM_TABLE_DISPLAY_NAME +" [-32768]\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + @@ -887,9 +887,9 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { */ "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX + "" + JOIN_ITEM_TABLE_DISPLAY_NAME+" [-32768]\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER AGGREGATE INTO DISTINCT ROWS BY [I.0:NAME]\n" + + " SERVER AGGREGATE INTO DISTINCT ROWS BY [\"I.0:NAME\"]\n" + "CLIENT MERGE SORT\n" + - "CLIENT SORTED BY [I.0:NAME]\n" + + "CLIENT SORTED BY [\"I.0:NAME\"]\n" + " PARALLEL LEFT-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME, /* @@ -979,7 +979,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { */ "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX +""+ JOIN_ITEM_TABLE_DISPLAY_NAME +" [-32768]\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER SORTED BY [I1.0:NAME, I2.0:NAME]\n" + + " SERVER SORTED BY [\"I1.0:NAME\", \"I2.0:NAME\"]\n" + "CLIENT MERGE SORT\n" + " PARALLEL INNER-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX +""+ JOIN_ITEM_TABLE_DISPLAY_NAME +" [-32768]\n" + @@ -1035,14 +1035,14 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { * ORDER BY c.customer_id, i.name */ "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + JOIN_CUSTOMER_TABLE_DISPLAY_NAME + " [*] - ['0000000005']\n" + - " SERVER SORTED BY [\"C.customer_id\", I.0:NAME]\n"+ + " SERVER SORTED BY [\"C.customer_id\", \"I.0:NAME\"]\n"+ "CLIENT MERGE SORT\n" + " PARALLEL INNER-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + " SERVER FILTER BY \"order_id\" != '000000000000003'\n" + " PARALLEL INNER-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX +""+ JOIN_ITEM_TABLE_DISPLAY_NAME +" [-32768]\n" + - " SERVER FILTER BY NAME != 'T3'\n" + + " SERVER FILTER BY \"NAME\" != 'T3'\n" + " CLIENT MERGE SORT\n" + " PARALLEL LEFT-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SUPPLIER_TABLE_DISPLAY_NAME + "\n" + @@ -1137,7 +1137,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT { " SERVER FILTER BY \"order_id\" != '000000000000003'\n" + " PARALLEL INNER-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX +""+JOIN_ITEM_TABLE_DISPLAY_NAME + " [-32768]\n" + - " SERVER FILTER BY NAME != 'T3'\n" + + " SERVER FILTER BY \"NAME\" != 'T3'\n" + " CLIENT MERGE SORT\n" + " PARALLEL LEFT-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SUPPLIER_TABLE_DISPLAY_NAME, http://git-wip-us.apache.org/repos/asf/phoenix/blob/2730e874/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinLocalIndexIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinLocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinLocalIndexIT.java index 45e80c6..2d0cc72 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinLocalIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinLocalIndexIT.java @@ -109,7 +109,7 @@ public class HashJoinLocalIndexIT extends BaseHBaseManagedTimeIT { "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX + JOIN_SUPPLIER_TABLE_DISPLAY_NAME + " [-32768,'S1']\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER AGGREGATE INTO DISTINCT ROWS BY [S.0:PHONE]\n" + + " SERVER AGGREGATE INTO DISTINCT ROWS BY [\"S.0:PHONE\"]\n" + "CLIENT MERGE SORT\n" + " PARALLEL INNER-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX + JOIN_ITEM_TABLE_DISPLAY_NAME + " [-32768,*] - [-32768,'T6']\n" + http://git-wip-us.apache.org/repos/asf/phoenix/blob/2730e874/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java index 2d11c5c..7bc97e7 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java @@ -186,7 +186,7 @@ public class SubqueryIT extends BaseHBaseManagedTimeIT { "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SCHEMA + ".idx_supplier\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER SORTED BY [I.0:NAME]\n" + + " SERVER SORTED BY [\"I.0:NAME\"]\n" + "CLIENT MERGE SORT\n" + " PARALLEL LEFT-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SCHEMA + ".idx_item\n" + @@ -200,7 +200,7 @@ public class SubqueryIT extends BaseHBaseManagedTimeIT { " PARALLEL LEFT-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SCHEMA + ".idx_item\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[NAME, \"item_id\"\\]\n" + + " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[\"NAME\", \"item_id\"\\]\n" + " CLIENT MERGE SORT\n" + " PARALLEL ANTI-JOIN TABLE 0 \\(SKIP MERGE\\)\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + @@ -209,7 +209,7 @@ public class SubqueryIT extends BaseHBaseManagedTimeIT { " PARALLEL LEFT-JOIN TABLE 1\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SCHEMA + ".idx_item\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[NAME, \"item_id\"\\]\n" + + " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[\"NAME\", \"item_id\"\\]\n" + " CLIENT MERGE SORT\n" + " PARALLEL SEMI-JOIN TABLE 0 \\(SKIP MERGE\\)\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + @@ -237,7 +237,7 @@ public class SubqueryIT extends BaseHBaseManagedTimeIT { " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + " SERVER AGGREGATE INTO DISTINCT ROWS BY \\[\"item_id\"\\]\n" + " CLIENT MERGE SORT\n" + - " AFTER-JOIN SERVER FILTER BY \\(I.0:NAME = 'T2' OR O.QUANTITY > \\$\\d+.\\$\\d+\\)" + " AFTER-JOIN SERVER FILTER BY \\(\"I.0:NAME\" = 'T2' OR O.QUANTITY > \\$\\d+.\\$\\d+\\)" }}); testCases.add(new String[][] { { @@ -259,7 +259,7 @@ public class SubqueryIT extends BaseHBaseManagedTimeIT { "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX + JOIN_SUPPLIER_TABLE_DISPLAY_NAME + " [-32768]\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER SORTED BY [I.0:NAME]\n" + + " SERVER SORTED BY [\"I.0:NAME\"]\n" + "CLIENT MERGE SORT\n" + " PARALLEL LEFT-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX + JOIN_ITEM_TABLE_DISPLAY_NAME + " [-32768]\n" + @@ -274,7 +274,7 @@ public class SubqueryIT extends BaseHBaseManagedTimeIT { " PARALLEL LEFT-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX + JOIN_ITEM_TABLE_DISPLAY_NAME + " \\[-32768\\]\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[NAME, \"item_id\"\\]\n" + + " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[\"NAME\", \"item_id\"\\]\n" + " CLIENT MERGE SORT\n" + " PARALLEL ANTI-JOIN TABLE 0 \\(SKIP MERGE\\)\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + @@ -283,7 +283,7 @@ public class SubqueryIT extends BaseHBaseManagedTimeIT { " PARALLEL LEFT-JOIN TABLE 1\n" + " CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX + JOIN_ITEM_TABLE_DISPLAY_NAME + " \\[-32768\\]\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[NAME, \"item_id\"\\]\n" + + " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[\"NAME\", \"item_id\"\\]\n" + " CLIENT MERGE SORT\n" + " PARALLEL SEMI-JOIN TABLE 0 \\(SKIP MERGE\\)\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + @@ -315,7 +315,7 @@ public class SubqueryIT extends BaseHBaseManagedTimeIT { " SERVER AGGREGATE INTO DISTINCT ROWS BY \\[\"item_id\"\\]\n" + " CLIENT MERGE SORT\n" + " DYNAMIC SERVER FILTER BY \"item_id\" IN \\(\"O.item_id\"\\)\n" + - " AFTER-JOIN SERVER FILTER BY \\(I.0:NAME = 'T2' OR O.QUANTITY > \\$\\d+.\\$\\d+\\)\n" + + " AFTER-JOIN SERVER FILTER BY \\(\"I.0:NAME\" = 'T2' OR O.QUANTITY > \\$\\d+.\\$\\d+\\)\n" + " DYNAMIC SERVER FILTER BY \"customer_id\" IN \\(\\$\\d+.\\$\\d+\\)" }}); return testCases; http://git-wip-us.apache.org/repos/asf/phoenix/blob/2730e874/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryUsingSortMergeJoinIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryUsingSortMergeJoinIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryUsingSortMergeJoinIT.java index 7457e02..f931bae 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryUsingSortMergeJoinIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryUsingSortMergeJoinIT.java @@ -188,7 +188,7 @@ public class SubqueryUsingSortMergeJoinIT extends BaseHBaseManagedTimeIT { " SERVER AGGREGATE INTO DISTINCT ROWS BY [\"item_id\"]\n" + " CLIENT MERGE SORT\n" + " CLIENT SORTED BY [\"item_id\"]\n" + - "CLIENT SORTED BY [I.0:NAME]", + "CLIENT SORTED BY [\"I.0:NAME\"]", "SORT-MERGE-JOIN \\(LEFT\\) TABLES\n" + " SORT-MERGE-JOIN \\(LEFT\\) TABLES\n" + @@ -197,9 +197,9 @@ public class SubqueryUsingSortMergeJoinIT extends BaseHBaseManagedTimeIT { " AND\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SCHEMA + ".idx_item\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[NAME, \"item_id\"\\]\n" + + " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[\"NAME\", \"item_id\"\\]\n" + " CLIENT MERGE SORT\n" + - " CLIENT SORTED BY \\[\"item_id\", NAME\\]\n" + + " CLIENT SORTED BY \\[\"item_id\", \"NAME\"\\]\n" + " PARALLEL ANTI-JOIN TABLE 0 \\(SKIP MERGE\\)\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + " SERVER AGGREGATE INTO DISTINCT ROWS BY \\[\"item_id\"\\]\n" + @@ -208,9 +208,9 @@ public class SubqueryUsingSortMergeJoinIT extends BaseHBaseManagedTimeIT { "AND\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_SCHEMA + ".idx_item\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[NAME, \"item_id\"\\]\n" + + " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[\"NAME\", \"item_id\"\\]\n" + " CLIENT MERGE SORT\n" + - " CLIENT SORTED BY \\[\"item_id\", NAME\\]\n" + + " CLIENT SORTED BY \\[\"item_id\", \"NAME\"\\]\n" + " PARALLEL SEMI-JOIN TABLE 0 \\(SKIP MERGE\\)\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + " SERVER AGGREGATE INTO DISTINCT ROWS BY \\[\"item_id\"\\]\n" + @@ -234,7 +234,7 @@ public class SubqueryUsingSortMergeJoinIT extends BaseHBaseManagedTimeIT { " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + " SERVER AGGREGATE INTO DISTINCT ROWS BY \\[\"item_id\"\\]\n" + " CLIENT MERGE SORT\n" + - " AFTER-JOIN SERVER FILTER BY \\(I.0:NAME = 'T2' OR O.QUANTITY > \\$\\d+.\\$\\d+\\)", + " AFTER-JOIN SERVER FILTER BY \\(\"I.0:NAME\" = 'T2' OR O.QUANTITY > \\$\\d+.\\$\\d+\\)", }}); testCases.add(new String[][] { { @@ -258,7 +258,7 @@ public class SubqueryUsingSortMergeJoinIT extends BaseHBaseManagedTimeIT { " SERVER AGGREGATE INTO DISTINCT ROWS BY [\"item_id\"]\n" + " CLIENT MERGE SORT\n" + " CLIENT SORTED BY [\"item_id\"]\n" + - "CLIENT SORTED BY [I.0:NAME]", + "CLIENT SORTED BY [\"I.0:NAME\"]", "SORT-MERGE-JOIN \\(LEFT\\) TABLES\n" + " SORT-MERGE-JOIN \\(LEFT\\) TABLES\n" + @@ -267,9 +267,9 @@ public class SubqueryUsingSortMergeJoinIT extends BaseHBaseManagedTimeIT { " AND\n" + " CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX + JOIN_ITEM_TABLE_DISPLAY_NAME + " \\[-32768\\]\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[NAME, \"item_id\"\\]\n" + + " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[\"NAME\", \"item_id\"\\]\n" + " CLIENT MERGE SORT\n" + - " CLIENT SORTED BY \\[\"item_id\", NAME\\]\n" + + " CLIENT SORTED BY \\[\"item_id\", \"NAME\"\\]\n" + " PARALLEL ANTI-JOIN TABLE 0 \\(SKIP MERGE\\)\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + " SERVER AGGREGATE INTO DISTINCT ROWS BY \\[\"item_id\"\\]\n" + @@ -278,9 +278,9 @@ public class SubqueryUsingSortMergeJoinIT extends BaseHBaseManagedTimeIT { "AND\n" + " CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX + JOIN_ITEM_TABLE_DISPLAY_NAME + " \\[-32768\\]\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + - " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[NAME, \"item_id\"\\]\n" + + " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY \\[\"NAME\", \"item_id\"\\]\n" + " CLIENT MERGE SORT\n" + - " CLIENT SORTED BY \\[\"item_id\", NAME\\]\n" + + " CLIENT SORTED BY \\[\"item_id\", \"NAME\"\\]\n" + " PARALLEL SEMI-JOIN TABLE 0 \\(SKIP MERGE\\)\n" + " CLIENT PARALLEL 1-WAY FULL SCAN OVER " + JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" + " SERVER AGGREGATE INTO DISTINCT ROWS BY \\[\"item_id\"\\]\n" + @@ -306,7 +306,7 @@ public class SubqueryUsingSortMergeJoinIT extends BaseHBaseManagedTimeIT { " SERVER AGGREGATE INTO DISTINCT ROWS BY \\[\"item_id\"\\]\n" + " CLIENT MERGE SORT\n" + " DYNAMIC SERVER FILTER BY \"item_id\" IN \\(\"O.item_id\"\\)\n" + - " AFTER-JOIN SERVER FILTER BY \\(I.0:NAME = 'T2' OR O.QUANTITY > \\$\\d+.\\$\\d+\\)", + " AFTER-JOIN SERVER FILTER BY \\(\"I.0:NAME\" = 'T2' OR O.QUANTITY > \\$\\d+.\\$\\d+\\)", }}); return testCases; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2730e874/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java index db1e58f..003db4c 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java @@ -451,6 +451,6 @@ public class ViewIT extends BaseViewIT { String queryPlan = QueryUtil.getExplainPlan(rs); assertEquals( "CLIENT PARALLEL 1-WAY SKIP SCAN ON 4 KEYS OVER I1 [1,100] - [2,109]\n" + - " SERVER FILTER BY (S2 = 'bas' AND \"S1\" = 'foo')", queryPlan); + " SERVER FILTER BY (\"S2\" = 'bas' AND \"S1\" = 'foo')", queryPlan); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2730e874/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseMutableIndexIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseMutableIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseMutableIndexIT.java index db1f6fb..b2f8630 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseMutableIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseMutableIndexIT.java @@ -314,7 +314,7 @@ public abstract class BaseMutableIndexIT extends BaseHBaseManagedTimeIT { query = "SELECT b.* from " + TestUtil.DEFAULT_DATA_TABLE_FULL_NAME + " where int_col1 = 4"; rs = conn.createStatement().executeQuery("EXPLAIN " + query); assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER _LOCAL_IDX_" + TestUtil.DEFAULT_DATA_TABLE_FULL_NAME +" [-32768]\n" + - " SERVER FILTER BY TO_INTEGER(INT_COL1) = 4\nCLIENT MERGE SORT", QueryUtil.getExplainPlan(rs)); + " SERVER FILTER BY TO_INTEGER(\"INT_COL1\") = 4\nCLIENT MERGE SORT", QueryUtil.getExplainPlan(rs)); rs = conn.createStatement().executeQuery(query); assertTrue(rs.next()); assertEquals("varchar_b", rs.getString(1)); @@ -391,11 +391,11 @@ public abstract class BaseMutableIndexIT extends BaseHBaseManagedTimeIT { rs = conn.createStatement().executeQuery("EXPLAIN " + query); if(localIndex){ assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER _LOCAL_IDX_" +TestUtil.DEFAULT_DATA_TABLE_FULL_NAME + " [-32768,~'1']\n" + - " SERVER SORTED BY [V1]\n" + + " SERVER SORTED BY [\"V1\"]\n" + "CLIENT MERGE SORT", QueryUtil.getExplainPlan(rs)); } else { assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER " +TestUtil.DEFAULT_INDEX_TABLE_FULL_NAME + " [~'1']\n" + - " SERVER SORTED BY [V1]\n" + + " SERVER SORTED BY [\"V1\"]\n" + "CLIENT MERGE SORT", QueryUtil.getExplainPlan(rs)); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2730e874/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java index e54e6a2..932c68b 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java @@ -322,8 +322,8 @@ public class GlobalIndexOptimizationIT extends BaseHBaseManagedTimeIT { " SERVER FILTER BY V1 = 'a'\n" + " SKIP-SCAN-JOIN TABLE 0\n" + " CLIENT PARALLEL 1-WAY SKIP SCAN ON 2 KEYS OVER _IDX_T \\[-32768,1\\] - \\[-32768,2\\]\n" + - " SERVER FILTER BY FIRST KEY ONLY AND K2 IN \\(3,4\\)\n" + - " DYNAMIC SERVER FILTER BY \\(\"T_ID\", \"K1\", \"K2\"\\) IN \\(\\(\\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+\\)\\)"; + " SERVER FILTER BY FIRST KEY ONLY AND \"K2\" IN (3,4)\n" + + " DYNAMIC SERVER FILTER BY (\"T_ID\", \"K1\", \"K2\") IN \\(\\(\\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+\\)\\)"; assertTrue("Expected:\n" + expected + "\ndid not match\n" + actual, Pattern.matches(expected,actual)); rs = conn1.createStatement().executeQuery(query); http://git-wip-us.apache.org/repos/asf/phoenix/blob/2730e874/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java index 6ff0475..9e66bbf 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java @@ -471,7 +471,7 @@ public class LocalIndexIT extends BaseHBaseManagedTimeIT { "CLIENT PARALLEL " + numRegions + "-WAY RANGE SCAN OVER " + MetaDataUtil.getLocalIndexTableName(TestUtil.DEFAULT_DATA_TABLE_NAME)+" [-32768,*] - [-32768,'z']\n" + " SERVER FILTER BY FIRST KEY ONLY\n" - + " SERVER AGGREGATE INTO DISTINCT ROWS BY [V1, T_ID, K3]\n" + "CLIENT MERGE SORT", + + " SERVER AGGREGATE INTO DISTINCT ROWS BY [\"V1\", \"T_ID\", \"K3\"]\n" + "CLIENT MERGE SORT", QueryUtil.getExplainPlan(rs)); rs = conn1.createStatement().executeQuery(query); @@ -499,7 +499,7 @@ public class LocalIndexIT extends BaseHBaseManagedTimeIT { "CLIENT PARALLEL " + numRegions + "-WAY RANGE SCAN OVER " + MetaDataUtil.getLocalIndexTableName(TestUtil.DEFAULT_DATA_TABLE_NAME)+" [-32768,*] - [-32768,'z']\n" + " SERVER FILTER BY FIRST KEY ONLY\n" - + " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY [V1]\nCLIENT MERGE SORT", + + " SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY [\"V1\"]\nCLIENT MERGE SORT", QueryUtil.getExplainPlan(rs)); PhoenixStatement stmt = conn1.createStatement().unwrap(PhoenixStatement.class); http://git-wip-us.apache.org/repos/asf/phoenix/blob/2730e874/phoenix-core/src/main/java/org/apache/phoenix/compile/IndexStatementRewriter.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/IndexStatementRewriter.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/IndexStatementRewriter.java index 4c66dd7..6f2cbfa 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/IndexStatementRewriter.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/IndexStatementRewriter.java @@ -34,8 +34,8 @@ import org.apache.phoenix.parse.TableWildcardParseNode; import org.apache.phoenix.parse.WildcardParseNode; import org.apache.phoenix.schema.ColumnRef; import org.apache.phoenix.schema.PColumn; -import org.apache.phoenix.schema.types.PDataType; import org.apache.phoenix.schema.TableRef; +import org.apache.phoenix.schema.types.PDataType; import org.apache.phoenix.util.IndexUtil; public class IndexStatementRewriter extends ParseNodeRewriter { @@ -107,8 +107,7 @@ public class IndexStatementRewriter extends ParseNodeRewriter { return node; String indexColName = IndexUtil.getIndexColumnName(dataCol); - // FIXME: why isn't this always case sensitive? - ParseNode indexColNode = new ColumnParseNode(tName, node.isCaseSensitive() ? '"' + indexColName + '"' : indexColName, node.getAlias()); + ParseNode indexColNode = new ColumnParseNode(tName, '"' + indexColName + '"', node.getAlias()); PDataType indexColType = IndexUtil.getIndexColumnDataType(dataCol); PDataType dataColType = dataColRef.getColumn().getDataType();