This is an automated email from the ASF dual-hosted git repository. achouhan pushed a commit to branch 4.14-HBase-1.4 in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/4.14-HBase-1.4 by this push: new 0975e11 PHOENIX-5704 Covered column updates are not generated for previously deleted data table row 0975e11 is described below commit 0975e11e246a7d992261aee6777ac03448554559 Author: Abhishek Singh Chouhan <abhishekchouhan...@gmail.com> AuthorDate: Mon Feb 3 12:05:19 2020 -0800 PHOENIX-5704 Covered column updates are not generated for previously deleted data table row --- .../phoenix/end2end/index/MutableIndexIT.java | 53 ++++++++++++++++++++-- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java index a2635d7..4ebeb7b 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java @@ -930,11 +930,11 @@ public class MutableIndexIT extends ParallelStatsDisabledIT { try (Connection conn = getConnection()) { conn.createStatement().execute( "create table " + fullTableName + " (id integer primary key, " - + (multiCf ? columnFamily1 : "") + "f float, " - + (multiCf ? columnFamily2 : "") + "s varchar)" + tableDDLOptions); + + (multiCf ? columnFamily1 + "." : "") + "f float, " + + (multiCf ? columnFamily2 + "." : "") + "s varchar)" + tableDDLOptions); conn.createStatement().execute( "create index " + indexName + " on " + fullTableName + " (" - + (multiCf ? columnFamily1 : "") + "f) include ("+(multiCf ? columnFamily2 : "") +"s)"); + + (multiCf ? columnFamily1 + "." : "") + "f) include ("+(multiCf ? columnFamily2 + "." : "") +"s)"); conn.createStatement().execute( "upsert into " + fullTableName + " values (1, 0.5, 'foo')"); conn.commit(); @@ -949,9 +949,52 @@ public class MutableIndexIT extends ParallelStatsDisabledIT { assertEquals(0.5F, rs.getFloat(1), 0.0); assertEquals("foo", rs.getString(3)); } - } + } + + @Test + public void testUpsertingDeletedRowWithNullCoveredColumn() throws Exception { + testUpsertingDeletedRowWithNullCoveredColumn(false); + } - /** + @Test + public void testUpsertingDeletedRowWithNullCoveredColumnMultiCfs() throws Exception { + testUpsertingDeletedRowWithNullCoveredColumn(true); + } + + public void testUpsertingDeletedRowWithNullCoveredColumn(boolean multiCf) throws Exception { + String tableName = "TBL_" + generateUniqueName(); + String indexName = "IDX_" + generateUniqueName(); + String columnFamily1 = "cf1"; + String columnFamily2 = "cf2"; + String fullTableName = SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName); + String fullIndexName = SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName); + try (Connection conn = getConnection()) { + conn.createStatement() + .execute("create table " + fullTableName + " (id integer primary key, " + + (multiCf ? columnFamily1 + "." : "") + "f varchar, " + + (multiCf ? columnFamily2 + "." : "") + "s varchar)" + + tableDDLOptions); + conn.createStatement() + .execute("create " + (localIndex ? "LOCAL" : "") + " index " + indexName + + " on " + fullTableName + " (" + (multiCf ? columnFamily1 + "." : "") + + "f) include (" + (multiCf ? columnFamily2 + "." : "") + "s)"); + conn.createStatement() + .execute("upsert into " + fullTableName + " values (1, 'foo', 'bar')"); + conn.commit(); + conn.createStatement().execute("delete from " + fullTableName + " where id = 1"); + conn.commit(); + conn.createStatement() + .execute("upsert into " + fullTableName + " values (1, null, 'bar')"); + conn.commit(); + ResultSet rs = conn.createStatement().executeQuery("select * from " + fullIndexName); + assertTrue(rs.next()); + assertEquals(1, rs.getInt(2)); + assertEquals(null, rs.getString(1)); + assertEquals("bar", rs.getString(3)); + } + } + + /** * PHOENIX-4988 * Test updating only a non-indexed column after two successive deletes to an indexed row */