This is an automated email from the ASF dual-hosted git repository.
achouhan pushed a commit to branch 4.15-HBase-1.5
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/4.15-HBase-1.5 by this push:
new 426078e PHOENIX-5704 Covered column updates are not generated for
previously deleted data table row
426078e is described below
commit 426078ea9794f0f5a5037fc579bbf1c27c02409e
Author: Abhishek Singh Chouhan <[email protected]>
AuthorDate: Mon Feb 3 10:12:00 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 f17451d..f61f02c 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
@@ -767,11 +767,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 " + (localIndex ? "LOCAL" : "") + " 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();
@@ -786,9 +786,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
*/