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

Add binary dtype to Series.in/2 #477

Conversation

Jhonatannunessilva
Copy link
Contributor

This PR allows the Series.in/2 function to receive series with binary dtype.

Addition to: #420 and #475

Before this PR, if you try to compare two binary series using the Series.in/2 function, an error will be returned:

iex(1)> s1 = Explorer.Series.from_list([<<239, 191, 19>>, <<2>>, <<3>>], dtype: :binary)
#Explorer.Series<
  Polars[3]
  binary [<<239, 191, 19>>, <<2>>, <<3>>]
>

iex(2)> s2 = Explorer.Series.from_list([<<239, 191, 19>>, <<0>>, <<3>>], dtype: :binary)
#Explorer.Series<
  Polars[3]
  binary [<<239, 191, 19>>, <<0>>, <<3>>]
>

iex(3)> Explorer.Series.in(s1, s2)
** (ErlangError) Erlang error: :nif_panicked
    (explorer 0.6.0-dev) Explorer.PolarsBackend.Native.s_in(%Inspect.Error{message: "got FunctionClauseError with message \"no function clause matching in Explorer.PolarsBackend.Shared.apply_series/3\" while inspecting %{__struct__: Explorer.PolarsBackend.Series, resource: #Reference<0.3313078941.1795293224.105471>}"}, %Inspect.Error{message: "got FunctionClauseError with message \"no function clause matching in Explorer.PolarsBackend.Shared.apply_series/3\" while inspecting %{__struct__: Explorer.PolarsBackend.Series, resource: #Reference<0.3313078941.1795293224.105473>}"})
    (explorer 0.6.0-dev) lib/explorer/polars_backend/shared.ex:23: Explorer.PolarsBackend.Shared.apply_series/3

After this PR the result is:

iex(3)> Explorer.Series.in(s1, s2)                                                      
#Explorer.Series<
  Polars[3]
  boolean [true, false, true]
>

Copy link
Member

@philss philss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you for the tests as well! :D :shipit:

@josevalim josevalim merged commit b4a4560 into elixir-explorer:main Jan 18, 2023
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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 this pull request may close these issues.

3 participants