[23/30] phoenix git commit: PHOENIX-2746 Delete on the table with immutable rows may fail with INVALID_FILTER_ON_IMMUTABLE_ROWS error code.(Rajeshbabu)
PHOENIX-2746 Delete on the table with immutable rows may fail with INVALID_FILTER_ON_IMMUTABLE_ROWS error code.(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cd8e86ca Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cd8e86ca Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cd8e86ca Branch: refs/heads/calcite Commit: cd8e86ca7170876a30771fcc16c027f8dc8dd386 Parents: e7bcfe4 Author: Rajeshbabu ChintaguntlaAuthored: Fri Mar 18 01:28:53 2016 +0530 Committer: Rajeshbabu Chintaguntla Committed: Fri Mar 18 01:28:53 2016 +0530 -- .../org/apache/phoenix/end2end/DeleteIT.java| 12 + .../apache/phoenix/compile/DeleteCompiler.java | 28 +++- .../apache/phoenix/optimize/QueryOptimizer.java | 14 ++ .../org/apache/phoenix/schema/PTableImpl.java | 2 +- 4 files changed, 37 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/cd8e86ca/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java index 6b4eead..10152e3 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java @@ -19,6 +19,7 @@ package org.apache.phoenix.end2end; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.Date; @@ -370,6 +371,7 @@ public class DeleteIT extends BaseHBaseManagedTimeIT { "STATS.ACTIVE_VISITOR INTEGER " + "CONSTRAINT PK PRIMARY KEY (HOST, DOMAIN, FEATURE, DATE)) IMMUTABLE_ROWS=true"); stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx ON web_stats (DATE, FEATURE)"); +stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx2 ON web_stats (DATE, FEATURE, USAGE.DB)"); stm.close(); Date date = new Date(0); @@ -406,6 +408,16 @@ public class DeleteIT extends BaseHBaseManagedTimeIT { assertTrue(rs.next()); assertEquals(0, rs.getLong(1)); +stm.execute("DROP INDEX web_stats_idx ON web_stats"); +stm.execute("DROP INDEX web_stats_idx2 ON web_stats"); + +stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx ON web_stats (USAGE.DB)"); +stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx2 ON web_stats (USAGE.DB, DATE)"); +try{ +psInsert = con.prepareStatement("DELETE FROM web_stats WHERE USAGE.DB=2"); +} catch(Exception e) { +fail("There should not be any exception while deleting row"); +} } finally { try { con.close(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/cd8e86ca/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java index 8e9e1de..24a2add 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java @@ -22,6 +22,7 @@ import java.sql.ParameterMetaData; import java.sql.SQLException; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -233,18 +234,18 @@ public class DeleteCompiler { } -private Set getNonDisabledImmutableIndexes(TableRef tableRef) { +private Map getNonDisabledImmutableIndexes(TableRef tableRef) { PTable table = tableRef.getTable(); if (table.isImmutableRows() && !table.getIndexes().isEmpty()) { -Set nonDisabledIndexes = Sets.newHashSetWithExpectedSize(table.getIndexes().size()); +Map nonDisabledIndexes = new HashMap (table.getIndexes().size()); for (PTable index : table.getIndexes()) { if (index.getIndexState() != PIndexState.DISABLE) { -nonDisabledIndexes.add(index); +nonDisabledIndexes.put(index.getKey(), index); } } return nonDisabledIndexes;
phoenix git commit: PHOENIX-2746 Delete on the table with immutable rows may fail with INVALID_FILTER_ON_IMMUTABLE_ROWS error code.(Rajeshbabu)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 4ddf63ec9 -> 57bd7988c PHOENIX-2746 Delete on the table with immutable rows may fail with INVALID_FILTER_ON_IMMUTABLE_ROWS error code.(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/57bd7988 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/57bd7988 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/57bd7988 Branch: refs/heads/4.x-HBase-0.98 Commit: 57bd7988c3aa663596309b1c73a998ce69476f03 Parents: 4ddf63e Author: Rajeshbabu ChintaguntlaAuthored: Fri Mar 18 01:34:38 2016 +0530 Committer: Rajeshbabu Chintaguntla Committed: Fri Mar 18 01:34:38 2016 +0530 -- .../org/apache/phoenix/end2end/DeleteIT.java| 12 + .../apache/phoenix/compile/DeleteCompiler.java | 28 +++- .../apache/phoenix/optimize/QueryOptimizer.java | 14 ++ .../org/apache/phoenix/schema/PTableImpl.java | 2 +- 4 files changed, 37 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/57bd7988/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java index 6b4eead..10152e3 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java @@ -19,6 +19,7 @@ package org.apache.phoenix.end2end; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.Date; @@ -370,6 +371,7 @@ public class DeleteIT extends BaseHBaseManagedTimeIT { "STATS.ACTIVE_VISITOR INTEGER " + "CONSTRAINT PK PRIMARY KEY (HOST, DOMAIN, FEATURE, DATE)) IMMUTABLE_ROWS=true"); stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx ON web_stats (DATE, FEATURE)"); +stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx2 ON web_stats (DATE, FEATURE, USAGE.DB)"); stm.close(); Date date = new Date(0); @@ -406,6 +408,16 @@ public class DeleteIT extends BaseHBaseManagedTimeIT { assertTrue(rs.next()); assertEquals(0, rs.getLong(1)); +stm.execute("DROP INDEX web_stats_idx ON web_stats"); +stm.execute("DROP INDEX web_stats_idx2 ON web_stats"); + +stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx ON web_stats (USAGE.DB)"); +stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx2 ON web_stats (USAGE.DB, DATE)"); +try{ +psInsert = con.prepareStatement("DELETE FROM web_stats WHERE USAGE.DB=2"); +} catch(Exception e) { +fail("There should not be any exception while deleting row"); +} } finally { try { con.close(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/57bd7988/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java index 8e9e1de..24a2add 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java @@ -22,6 +22,7 @@ import java.sql.ParameterMetaData; import java.sql.SQLException; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -233,18 +234,18 @@ public class DeleteCompiler { } -private Set getNonDisabledImmutableIndexes(TableRef tableRef) { +private Map getNonDisabledImmutableIndexes(TableRef tableRef) { PTable table = tableRef.getTable(); if (table.isImmutableRows() && !table.getIndexes().isEmpty()) { -Set nonDisabledIndexes = Sets.newHashSetWithExpectedSize(table.getIndexes().size()); +Map nonDisabledIndexes = new HashMap (table.getIndexes().size()); for (PTable index : table.getIndexes()) { if (index.getIndexState() != PIndexState.DISABLE) { -nonDisabledIndexes.add(index); +
phoenix git commit: PHOENIX-2746 Delete on the table with immutable rows may fail with INVALID_FILTER_ON_IMMUTABLE_ROWS error code.(Rajeshbabu)
Repository: phoenix Updated Branches: refs/heads/master e7bcfe4f2 -> cd8e86ca7 PHOENIX-2746 Delete on the table with immutable rows may fail with INVALID_FILTER_ON_IMMUTABLE_ROWS error code.(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cd8e86ca Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cd8e86ca Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cd8e86ca Branch: refs/heads/master Commit: cd8e86ca7170876a30771fcc16c027f8dc8dd386 Parents: e7bcfe4 Author: Rajeshbabu ChintaguntlaAuthored: Fri Mar 18 01:28:53 2016 +0530 Committer: Rajeshbabu Chintaguntla Committed: Fri Mar 18 01:28:53 2016 +0530 -- .../org/apache/phoenix/end2end/DeleteIT.java| 12 + .../apache/phoenix/compile/DeleteCompiler.java | 28 +++- .../apache/phoenix/optimize/QueryOptimizer.java | 14 ++ .../org/apache/phoenix/schema/PTableImpl.java | 2 +- 4 files changed, 37 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/cd8e86ca/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java index 6b4eead..10152e3 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java @@ -19,6 +19,7 @@ package org.apache.phoenix.end2end; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.Date; @@ -370,6 +371,7 @@ public class DeleteIT extends BaseHBaseManagedTimeIT { "STATS.ACTIVE_VISITOR INTEGER " + "CONSTRAINT PK PRIMARY KEY (HOST, DOMAIN, FEATURE, DATE)) IMMUTABLE_ROWS=true"); stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx ON web_stats (DATE, FEATURE)"); +stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx2 ON web_stats (DATE, FEATURE, USAGE.DB)"); stm.close(); Date date = new Date(0); @@ -406,6 +408,16 @@ public class DeleteIT extends BaseHBaseManagedTimeIT { assertTrue(rs.next()); assertEquals(0, rs.getLong(1)); +stm.execute("DROP INDEX web_stats_idx ON web_stats"); +stm.execute("DROP INDEX web_stats_idx2 ON web_stats"); + +stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx ON web_stats (USAGE.DB)"); +stm.execute("CREATE " + (localIndex ? "LOCAL" : "") + " INDEX web_stats_idx2 ON web_stats (USAGE.DB, DATE)"); +try{ +psInsert = con.prepareStatement("DELETE FROM web_stats WHERE USAGE.DB=2"); +} catch(Exception e) { +fail("There should not be any exception while deleting row"); +} } finally { try { con.close(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/cd8e86ca/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java index 8e9e1de..24a2add 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java @@ -22,6 +22,7 @@ import java.sql.ParameterMetaData; import java.sql.SQLException; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -233,18 +234,18 @@ public class DeleteCompiler { } -private Set getNonDisabledImmutableIndexes(TableRef tableRef) { +private Map getNonDisabledImmutableIndexes(TableRef tableRef) { PTable table = tableRef.getTable(); if (table.isImmutableRows() && !table.getIndexes().isEmpty()) { -Set nonDisabledIndexes = Sets.newHashSetWithExpectedSize(table.getIndexes().size()); +Map nonDisabledIndexes = new HashMap (table.getIndexes().size()); for (PTable index : table.getIndexes()) { if (index.getIndexState() != PIndexState.DISABLE) { -nonDisabledIndexes.add(index); +nonDisabledIndexes.put(index.getKey(),