[48/51] [abbrv] phoenix git commit: PHOENIX-4859 Using local index in where statement for join (only rhs table) query fails(Rajeshbabu)
PHOENIX-4859 Using local index in where statement for join (only rhs table) query fails(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/87026452 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/87026452 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/87026452 Branch: refs/heads/4.x-cdh5.15 Commit: 87026452ce92866583bd4fd6999d2c8e37ebd39f Parents: 00ba63b Author: Rajeshbabu Chintaguntla Authored: Tue Oct 9 11:30:32 2018 +0100 Committer: Pedro Boado Committed: Wed Oct 17 22:50:43 2018 +0100 -- .../phoenix/end2end/index/LocalIndexIT.java | 29 .../phoenix/compile/ExpressionCompiler.java | 2 +- .../apache/phoenix/compile/JoinCompiler.java| 2 +- .../phoenix/compile/ProjectionCompiler.java | 4 +-- .../compile/TupleProjectionCompiler.java| 2 +- .../phoenix/schema/LocalIndexDataColumnRef.java | 18 ++-- 6 files changed, 44 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/87026452/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 ed1cf45..e260969 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 @@ -684,6 +684,35 @@ public class LocalIndexIT extends BaseLocalIndexIT { conn1.close(); } +@Test +public void testLocalIndexSelfJoin() throws Exception { + String tableName = generateUniqueName(); + String indexName = "IDX_" + generateUniqueName(); + Connection conn1 = DriverManager.getConnection(getUrl()); + if (isNamespaceMapped) { + conn1.createStatement().execute("CREATE SCHEMA IF NOT EXISTS " + schemaName); + } +String ddl = +"CREATE TABLE " ++ tableName ++ " (customer_id integer primary key, postal_code varchar, country_code varchar)"; +conn1.createStatement().execute(ddl); +conn1.createStatement().execute("UPSERT INTO " + tableName + " values(1,'560103','IN')"); +conn1.commit(); +conn1.createStatement().execute( +"CREATE LOCAL INDEX " + indexName + " ON " + tableName + "(postal_code)"); +ResultSet rs = +conn1.createStatement() +.executeQuery( +"SELECT * from " ++ tableName ++ " c1, " ++ tableName ++ " c2 where c1.customer_id=c2.customer_id and c2.postal_code='560103'"); +assertTrue(rs.next()); +conn1.close(); +} + private void copyLocalIndexHFiles(Configuration conf, HRegionInfo fromRegion, HRegionInfo toRegion, boolean move) throws IOException { Path root = FSUtils.getRootDir(conf); http://git-wip-us.apache.org/repos/asf/phoenix/blob/87026452/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java index 9daa744..077e1af 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java @@ -376,7 +376,7 @@ public class ExpressionCompiler extends UnsupportedAllParseNodeVisitorhttp://git-wip-us.apache.org/repos/asf/phoenix/blob/87026452/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java index 36bfc5f..880fa72 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java @@ -869,7 +869,7 @@ public class JoinCompiler { if (columnRef.getTableRef().equals(tableRef) && (!retainPKColumns || !SchemaUtil.isPKColumn(columnRef.getColumn( { if (columnRef instanceof LocalIndexColumnRef) { -sourceColumns.add(new LocalIndexDataColumnRef(c
[14/22] phoenix git commit: PHOENIX-4859 Using local index in where statement for join (only rhs table) query fails(Rajeshbabu)
PHOENIX-4859 Using local index in where statement for join (only rhs table) query fails(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2ded8b64 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2ded8b64 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2ded8b64 Branch: refs/heads/omid2 Commit: 2ded8b64cdea48e89e7a0c936a59913a00345416 Parents: c90d090 Author: Rajeshbabu Chintaguntla Authored: Tue Oct 9 16:04:41 2018 +0530 Committer: Rajeshbabu Chintaguntla Committed: Tue Oct 9 16:04:41 2018 +0530 -- .../phoenix/end2end/index/LocalIndexIT.java | 29 .../phoenix/compile/ExpressionCompiler.java | 2 +- .../apache/phoenix/compile/JoinCompiler.java| 2 +- .../phoenix/compile/ProjectionCompiler.java | 4 +-- .../compile/TupleProjectionCompiler.java| 2 +- .../phoenix/schema/LocalIndexDataColumnRef.java | 18 ++-- 6 files changed, 44 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ded8b64/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 ed1cf45..e260969 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 @@ -684,6 +684,35 @@ public class LocalIndexIT extends BaseLocalIndexIT { conn1.close(); } +@Test +public void testLocalIndexSelfJoin() throws Exception { + String tableName = generateUniqueName(); + String indexName = "IDX_" + generateUniqueName(); + Connection conn1 = DriverManager.getConnection(getUrl()); + if (isNamespaceMapped) { + conn1.createStatement().execute("CREATE SCHEMA IF NOT EXISTS " + schemaName); + } +String ddl = +"CREATE TABLE " ++ tableName ++ " (customer_id integer primary key, postal_code varchar, country_code varchar)"; +conn1.createStatement().execute(ddl); +conn1.createStatement().execute("UPSERT INTO " + tableName + " values(1,'560103','IN')"); +conn1.commit(); +conn1.createStatement().execute( +"CREATE LOCAL INDEX " + indexName + " ON " + tableName + "(postal_code)"); +ResultSet rs = +conn1.createStatement() +.executeQuery( +"SELECT * from " ++ tableName ++ " c1, " ++ tableName ++ " c2 where c1.customer_id=c2.customer_id and c2.postal_code='560103'"); +assertTrue(rs.next()); +conn1.close(); +} + private void copyLocalIndexHFiles(Configuration conf, HRegionInfo fromRegion, HRegionInfo toRegion, boolean move) throws IOException { Path root = FSUtils.getRootDir(conf); http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ded8b64/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java index 9daa744..077e1af 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java @@ -376,7 +376,7 @@ public class ExpressionCompiler extends UnsupportedAllParseNodeVisitorhttp://git-wip-us.apache.org/repos/asf/phoenix/blob/2ded8b64/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java index 36bfc5f..880fa72 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java @@ -869,7 +869,7 @@ public class JoinCompiler { if (columnRef.getTableRef().equals(tableRef) && (!retainPKColumns || !SchemaUtil.isPKColumn(columnRef.getColumn( { if (columnRef instanceof LocalIndexColumnRef) { -sourceColumns.add(new LocalIndexDataColumn
phoenix git commit: PHOENIX-4859 Using local index in where statement for join (only rhs table) query fails(Rajeshbabu)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.4 e692f1494 -> 1e5c4cdbd PHOENIX-4859 Using local index in where statement for join (only rhs table) query fails(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/1e5c4cdb Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1e5c4cdb Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1e5c4cdb Branch: refs/heads/4.x-HBase-1.4 Commit: 1e5c4cdbd92b000d046657bb424b524fde4873a5 Parents: e692f14 Author: Rajeshbabu Chintaguntla Authored: Tue Oct 9 16:05:19 2018 +0530 Committer: Rajeshbabu Chintaguntla Committed: Tue Oct 9 16:05:19 2018 +0530 -- .../phoenix/end2end/index/LocalIndexIT.java | 29 .../phoenix/compile/ExpressionCompiler.java | 2 +- .../apache/phoenix/compile/JoinCompiler.java| 2 +- .../phoenix/compile/ProjectionCompiler.java | 4 +-- .../compile/TupleProjectionCompiler.java| 2 +- .../phoenix/schema/LocalIndexDataColumnRef.java | 18 ++-- 6 files changed, 44 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/1e5c4cdb/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 ed1cf45..e260969 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 @@ -684,6 +684,35 @@ public class LocalIndexIT extends BaseLocalIndexIT { conn1.close(); } +@Test +public void testLocalIndexSelfJoin() throws Exception { + String tableName = generateUniqueName(); + String indexName = "IDX_" + generateUniqueName(); + Connection conn1 = DriverManager.getConnection(getUrl()); + if (isNamespaceMapped) { + conn1.createStatement().execute("CREATE SCHEMA IF NOT EXISTS " + schemaName); + } +String ddl = +"CREATE TABLE " ++ tableName ++ " (customer_id integer primary key, postal_code varchar, country_code varchar)"; +conn1.createStatement().execute(ddl); +conn1.createStatement().execute("UPSERT INTO " + tableName + " values(1,'560103','IN')"); +conn1.commit(); +conn1.createStatement().execute( +"CREATE LOCAL INDEX " + indexName + " ON " + tableName + "(postal_code)"); +ResultSet rs = +conn1.createStatement() +.executeQuery( +"SELECT * from " ++ tableName ++ " c1, " ++ tableName ++ " c2 where c1.customer_id=c2.customer_id and c2.postal_code='560103'"); +assertTrue(rs.next()); +conn1.close(); +} + private void copyLocalIndexHFiles(Configuration conf, HRegionInfo fromRegion, HRegionInfo toRegion, boolean move) throws IOException { Path root = FSUtils.getRootDir(conf); http://git-wip-us.apache.org/repos/asf/phoenix/blob/1e5c4cdb/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java index 9daa744..077e1af 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java @@ -376,7 +376,7 @@ public class ExpressionCompiler extends UnsupportedAllParseNodeVisitorhttp://git-wip-us.apache.org/repos/asf/phoenix/blob/1e5c4cdb/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java index 36bfc5f..880fa72 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java @@ -869,7 +869,7 @@ public class JoinCompiler { if (columnRef.getTableRef().equals(tableRef) && (!retainPKColumns || !SchemaUtil.isPKColumn(columnRef.getColumn( { if (columnRef instance
phoenix git commit: PHOENIX-4859 Using local index in where statement for join (only rhs table) query fails(Rajeshbabu)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.3 c90d090a1 -> 2ded8b64c PHOENIX-4859 Using local index in where statement for join (only rhs table) query fails(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2ded8b64 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2ded8b64 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2ded8b64 Branch: refs/heads/4.x-HBase-1.3 Commit: 2ded8b64cdea48e89e7a0c936a59913a00345416 Parents: c90d090 Author: Rajeshbabu Chintaguntla Authored: Tue Oct 9 16:04:41 2018 +0530 Committer: Rajeshbabu Chintaguntla Committed: Tue Oct 9 16:04:41 2018 +0530 -- .../phoenix/end2end/index/LocalIndexIT.java | 29 .../phoenix/compile/ExpressionCompiler.java | 2 +- .../apache/phoenix/compile/JoinCompiler.java| 2 +- .../phoenix/compile/ProjectionCompiler.java | 4 +-- .../compile/TupleProjectionCompiler.java| 2 +- .../phoenix/schema/LocalIndexDataColumnRef.java | 18 ++-- 6 files changed, 44 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ded8b64/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 ed1cf45..e260969 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 @@ -684,6 +684,35 @@ public class LocalIndexIT extends BaseLocalIndexIT { conn1.close(); } +@Test +public void testLocalIndexSelfJoin() throws Exception { + String tableName = generateUniqueName(); + String indexName = "IDX_" + generateUniqueName(); + Connection conn1 = DriverManager.getConnection(getUrl()); + if (isNamespaceMapped) { + conn1.createStatement().execute("CREATE SCHEMA IF NOT EXISTS " + schemaName); + } +String ddl = +"CREATE TABLE " ++ tableName ++ " (customer_id integer primary key, postal_code varchar, country_code varchar)"; +conn1.createStatement().execute(ddl); +conn1.createStatement().execute("UPSERT INTO " + tableName + " values(1,'560103','IN')"); +conn1.commit(); +conn1.createStatement().execute( +"CREATE LOCAL INDEX " + indexName + " ON " + tableName + "(postal_code)"); +ResultSet rs = +conn1.createStatement() +.executeQuery( +"SELECT * from " ++ tableName ++ " c1, " ++ tableName ++ " c2 where c1.customer_id=c2.customer_id and c2.postal_code='560103'"); +assertTrue(rs.next()); +conn1.close(); +} + private void copyLocalIndexHFiles(Configuration conf, HRegionInfo fromRegion, HRegionInfo toRegion, boolean move) throws IOException { Path root = FSUtils.getRootDir(conf); http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ded8b64/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java index 9daa744..077e1af 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java @@ -376,7 +376,7 @@ public class ExpressionCompiler extends UnsupportedAllParseNodeVisitorhttp://git-wip-us.apache.org/repos/asf/phoenix/blob/2ded8b64/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java index 36bfc5f..880fa72 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java @@ -869,7 +869,7 @@ public class JoinCompiler { if (columnRef.getTableRef().equals(tableRef) && (!retainPKColumns || !SchemaUtil.isPKColumn(columnRef.getColumn( { if (columnRef instance
phoenix git commit: PHOENIX-4859 Using local index in where statement for join (only rhs table) query fails(Rajeshbabu)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 d4d5887b9 -> 52bcff6f4 PHOENIX-4859 Using local index in where statement for join (only rhs table) query fails(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/52bcff6f Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/52bcff6f Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/52bcff6f Branch: refs/heads/4.x-HBase-1.2 Commit: 52bcff6f421ef26779a8d89186eff54eada063ee Parents: d4d5887 Author: Rajeshbabu Chintaguntla Authored: Tue Oct 9 16:00:32 2018 +0530 Committer: Rajeshbabu Chintaguntla Committed: Tue Oct 9 16:00:32 2018 +0530 -- .../phoenix/end2end/index/LocalIndexIT.java | 29 .../phoenix/compile/ExpressionCompiler.java | 2 +- .../apache/phoenix/compile/JoinCompiler.java| 2 +- .../phoenix/compile/ProjectionCompiler.java | 4 +-- .../compile/TupleProjectionCompiler.java| 2 +- .../phoenix/schema/LocalIndexDataColumnRef.java | 18 ++-- 6 files changed, 44 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/52bcff6f/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 ed1cf45..e260969 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 @@ -684,6 +684,35 @@ public class LocalIndexIT extends BaseLocalIndexIT { conn1.close(); } +@Test +public void testLocalIndexSelfJoin() throws Exception { + String tableName = generateUniqueName(); + String indexName = "IDX_" + generateUniqueName(); + Connection conn1 = DriverManager.getConnection(getUrl()); + if (isNamespaceMapped) { + conn1.createStatement().execute("CREATE SCHEMA IF NOT EXISTS " + schemaName); + } +String ddl = +"CREATE TABLE " ++ tableName ++ " (customer_id integer primary key, postal_code varchar, country_code varchar)"; +conn1.createStatement().execute(ddl); +conn1.createStatement().execute("UPSERT INTO " + tableName + " values(1,'560103','IN')"); +conn1.commit(); +conn1.createStatement().execute( +"CREATE LOCAL INDEX " + indexName + " ON " + tableName + "(postal_code)"); +ResultSet rs = +conn1.createStatement() +.executeQuery( +"SELECT * from " ++ tableName ++ " c1, " ++ tableName ++ " c2 where c1.customer_id=c2.customer_id and c2.postal_code='560103'"); +assertTrue(rs.next()); +conn1.close(); +} + private void copyLocalIndexHFiles(Configuration conf, HRegionInfo fromRegion, HRegionInfo toRegion, boolean move) throws IOException { Path root = FSUtils.getRootDir(conf); http://git-wip-us.apache.org/repos/asf/phoenix/blob/52bcff6f/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java index 9daa744..077e1af 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java @@ -376,7 +376,7 @@ public class ExpressionCompiler extends UnsupportedAllParseNodeVisitorhttp://git-wip-us.apache.org/repos/asf/phoenix/blob/52bcff6f/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java index 36bfc5f..880fa72 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java @@ -869,7 +869,7 @@ public class JoinCompiler { if (columnRef.getTableRef().equals(tableRef) && (!retainPKColumns || !SchemaUtil.isPKColumn(columnRef.getColumn( { if (columnRef instance
phoenix git commit: PHOENIX-4859 Using local index in where statement for join (only rhs table) query fails(Rajeshbabu)
Repository: phoenix Updated Branches: refs/heads/master f7b053ac4 -> 9a818dd43 PHOENIX-4859 Using local index in where statement for join (only rhs table) query fails(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9a818dd4 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9a818dd4 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9a818dd4 Branch: refs/heads/master Commit: 9a818dd43527008890d7b1cfa353725ff042f630 Parents: f7b053a Author: Rajeshbabu Chintaguntla Authored: Tue Oct 9 12:36:42 2018 +0530 Committer: Rajeshbabu Chintaguntla Committed: Tue Oct 9 12:36:42 2018 +0530 -- .../phoenix/end2end/index/LocalIndexIT.java | 29 .../phoenix/compile/ExpressionCompiler.java | 2 +- .../apache/phoenix/compile/JoinCompiler.java| 2 +- .../phoenix/compile/ProjectionCompiler.java | 4 +-- .../compile/TupleProjectionCompiler.java| 2 +- .../phoenix/schema/LocalIndexDataColumnRef.java | 18 ++-- 6 files changed, 44 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/9a818dd4/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 3ff35d1..bd4d675 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 @@ -692,6 +692,35 @@ public class LocalIndexIT extends BaseLocalIndexIT { conn1.close(); } +@Test +public void testLocalIndexSelfJoin() throws Exception { + String tableName = generateUniqueName(); + String indexName = "IDX_" + generateUniqueName(); + Connection conn1 = DriverManager.getConnection(getUrl()); + if (isNamespaceMapped) { + conn1.createStatement().execute("CREATE SCHEMA IF NOT EXISTS " + schemaName); + } +String ddl = +"CREATE TABLE " ++ tableName ++ " (customer_id integer primary key, postal_code varchar, country_code varchar)"; +conn1.createStatement().execute(ddl); +conn1.createStatement().execute("UPSERT INTO " + tableName + " values(1,'560103','IN')"); +conn1.commit(); +conn1.createStatement().execute( +"CREATE LOCAL INDEX " + indexName + " ON " + tableName + "(postal_code)"); +ResultSet rs = +conn1.createStatement() +.executeQuery( +"SELECT * from " ++ tableName ++ " c1, " ++ tableName ++ " c2 where c1.customer_id=c2.customer_id and c2.postal_code='560103'"); +assertTrue(rs.next()); +conn1.close(); +} + private void copyLocalIndexHFiles(Configuration conf, RegionInfo fromRegion, RegionInfo toRegion, boolean move) throws IOException { Path root = FSUtils.getRootDir(conf); http://git-wip-us.apache.org/repos/asf/phoenix/blob/9a818dd4/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java index 9daa744..077e1af 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java @@ -376,7 +376,7 @@ public class ExpressionCompiler extends UnsupportedAllParseNodeVisitorhttp://git-wip-us.apache.org/repos/asf/phoenix/blob/9a818dd4/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java index 36bfc5f..880fa72 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java @@ -869,7 +869,7 @@ public class JoinCompiler { if (columnRef.getTableRef().equals(tableRef) && (!retainPKColumns || !SchemaUtil.isPKColumn(columnRef.getColumn( { if (columnRef instanceof LocalIndexCol