Skip to content

Commit

Permalink
Test for null result in DataIndexer.getOptimalPartialIndex (#5449)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcaudy authored and stanbrub committed May 3, 2024
1 parent 93d9268 commit 169d4eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public static DataIndex getOptimalPartialIndex(Table table, final String... keyC
.filter(Objects::nonNull)
.max(Comparator.comparingLong(dataIndex -> dataIndex.table().size()))
.orElse(null),
table::isRefreshing, DataIndex::isRefreshing);
table::isRefreshing, (final DataIndex result) -> result != null && result.isRefreshing());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,15 @@ private void testWhereInDependencyInternal(
}
}

@Test
public void testWhereInOptimalIndexSelectionWithNoneAvailable() {
final Table lhs = emptyTable(10).update("Part=ii % 2 == 0 ? `Apple` : `Pie`", "Hello=ii", "Goodbye = `A`+ii");
DataIndexer.getOrCreateDataIndex(lhs, "Part");
final Table rhs = emptyTable(2).update("Hello=ii", "Goodbye = `A`+ii");
final Table result = lhs.whereIn(rhs, "Goodbye");
assertTableEquals(lhs.head(2), result);
}

@Test
public void testWhereDynamicIn() {
final QueryTable setTable = testRefreshingTable(i(2, 4, 6, 8).toTracking(), col("X", "A", "B", "C", "B"));
Expand Down

0 comments on commit 169d4eb

Please sign in to comment.