Skip to content

Commit

Permalink
test: Fix ArrayColumn Access WhereFilter Test (#5696)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbauernfeind authored Jun 28, 2024
1 parent b243c72 commit 92a5ad7
Showing 1 changed file with 29 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1448,18 +1448,38 @@ public void testEnsureColumnsTakePrecedence() {
}

@Test
@Ignore
public void testEnsureColumnArraysTakePrecedence() {
// TODO: column arrays aren't well supported in match arrays and this example's where filter fails to compile
final Table table = emptyTable(10).update("X=i", "Y=new int[]{1, 5, 9}");
ExecutionContext.getContext().getQueryScope().putParam("Y_", new int[] {0, 4, 8});
final Table table = emptyTable(10).update("X = i", "Y = ii == 1 ? 5 : -1");
ExecutionContext.getContext().getQueryScope().putParam("Y_", new int[] {0, 4, 0});

final Table result = table.where("X == Y_[1]");
Assert.equals(result.getRowSet(), "result.getRowSet()", RowSetFactory.fromKeys(5));
{
final Table result = table.where("X == Y_[1]");
Assert.equals(result.getRowSet(), "result.getRowSet()", RowSetFactory.fromKeys(5));

// check that the mirror matches the expected result
final Table mResult = table.where("Y_[1] == X");
assertTableEquals(result, mResult);
}

{
final Table result = table.where("X < Y_[1]");
Assert.equals(result.getRowSet(), "result.getRowSet()", RowSetFactory.flat(5));

// check that the mirror matches the expected result
final Table mResult = table.where("Y_[1] == X");
assertTableEquals(result, mResult);
// check that the mirror matches the expected result
final Table mResult = table.where("Y_[1] > X");
assertTableEquals(result, mResult);
}

// note that array access doesn't match the RangeFilter/MatchFilter regex, so let's try to override the
// array access with a type that would otherwise work.
ExecutionContext.getContext().getQueryScope().putParam("Y_", 4);
try {
table.where("X == Y_");
// noinspection ThrowableNotThrown
Assert.statementNeverExecuted();
} catch (IllegalArgumentException expected) {

}
}

@Test
Expand Down

0 comments on commit 92a5ad7

Please sign in to comment.