Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isIn(Collection) not matching Integers #1227

Open
m37r opened this issue Aug 17, 2023 · 0 comments
Open

isIn(Collection) not matching Integers #1227

m37r opened this issue Aug 17, 2023 · 0 comments

Comments

@m37r
Copy link

m37r commented Aug 17, 2023

For a given IntColumn, only the isIn(int...) method produces the expected results. The isIn(Collection) method inherited from NumericColumn matches actually contained numbers only when they are entered as Doubles into the query collection.

To test:

IntColumn column = IntColumn.create("c", 1, 2);
assertEquals(1, column.isIn(1).size()); // passes
assertEquals(1, column.isIn(Arrays.asList(1d)).size()); // passes
assertEquals(1, column.isIn(Arrays.asList(1)).size()); // fails

I think this is due to NumericColumn.isIn(Collection) using Collection.contains for matching against Double-converted content cells. I might even produce a fix.

m37r added a commit to m37r/tablesaw that referenced this issue Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant