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 · 1 comment · Fixed by tlabs-data/tablesaw#28
Open

isIn(Collection) not matching Integers #1227

m37r opened this issue Aug 17, 2023 · 1 comment · Fixed by tlabs-data/tablesaw#28

Comments

@m37r
Copy link
Contributor

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
ccleva added a commit to tlabs-data/tablesaw that referenced this issue Dec 14, 2024
ccleva pushed a commit to tlabs-data/tablesaw that referenced this issue Dec 14, 2024
ccleva added a commit to tlabs-data/tablesaw that referenced this issue Dec 14, 2024
ccleva pushed a commit to tlabs-data/tablesaw that referenced this issue Dec 14, 2024
@ccleva
Copy link
Contributor

ccleva commented Dec 16, 2024

Hi @m37r. This issue has been fixed using your PR in the new maintenance release from the maintenance fork. See this discussion for details.

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

Successfully merging a pull request may close this issue.

2 participants