You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ac...@apache.org on 2020/02/04 00:21:25 UTC
[phoenix] branch 4.x-HBase-1.4 updated: PHOENIX-5704 Covered column
updates are not generated for previously deleted data table row
This is an automated email from the ASF dual-hosted git repository.
achouhan pushed a commit to branch 4.x-HBase-1.4
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/4.x-HBase-1.4 by this push:
new 7f86943 PHOENIX-5704 Covered column updates are not generated for previously deleted data table row
7f86943 is described below
commit 7f86943e5eaba424c34efddd2847d61eef6e38c6
Author: Abhishek Singh Chouhan <ab...@gmail.com>
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
*/