Jacob Isaac created PHOENIX-7616:
------------------------------------
Summary: NPE when there are conditional expressions on indexed
columns
Key: PHOENIX-7616
URL: https://issues.apache.org/jira/browse/PHOENIX-7616
Project: Phoenix
Issue Type: Bug
Affects Versions: 5.3
Reporter: Jacob Isaac
To reproduce the following test can be included in ConditionalTTLExpressionIT
@Test
public void testNulls3() throws Exception {
if (tableLevelMaxLookback != 0) {
return;
}
String ttlExpression = "VAL2 = 345";
createTable(ttlExpression);
List<String> indexedColumns = Lists.newArrayList("VAL2"); // indexed column is
null
List<String> includedColumns = Lists.newArrayList("VAL4");
String indexName = createIndex(indexedColumns, includedColumns, false);
String tableName = schemaBuilder.getEntityTableName();
injectEdge();
int rowCount = 1;
long actual;
try (Connection conn = DriverManager.getConnection(getUrl())) {
populateTable(conn, rowCount);
actual = TestUtil.getRowCount(conn, tableName, true);
assertEquals(rowCount, actual);
// expire the row
updateColumns(conn, 0,
Lists.newArrayList("VAL2", "VAL4"), Lists.newArrayList(null, null));
actual = TestUtil.getRowCount(conn, tableName, true);
assertEquals(1, actual);
actual = TestUtil.getRowCountFromIndex(conn, tableName, indexName);
assertEquals(1, actual);
// now do a partial update over the expired row,
int newVal =123;
updateColumn(conn, 0, "VAL2", newVal);
try (ResultSet rs = readRow(conn, 0)) {
assertTrue(rs.next());
for (String col : COLUMNS) {
if (!col.equals("VAL2") && !col.equals("VAL4") ) {
assertNotNull(rs.getObject(col));
} else if (col.equals("VAL4")) {
assertNull(rs.getObject(col));
} else {
assertEquals(newVal, rs.getInt("VAL2"));
}
}
}
actual = TestUtil.getRowCount(conn, tableName, true);
assertEquals(1, actual);
actual = TestUtil.getRowCountFromIndex(conn, tableName, indexName);
assertEquals(1, actual);
verifyIndexTable(tableName, indexName, conn);
}
}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)