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

Panic for list of lists with nil entries #976

Closed
maennchen opened this issue Sep 3, 2024 · 1 comment · Fixed by #980
Closed

Panic for list of lists with nil entries #976

maennchen opened this issue Sep 3, 2024 · 1 comment · Fixed by #980

Comments

@maennchen
Copy link
Contributor

Code

Explorer.DataFrame.new(
  [
    %{addresses: nil},
    %{
      addresses: [
        %{lines: ["Nadarzyn Mszczonowska 24"]},
        %{lines: ["Nadarzyn Mszczonowska 24"]}
      ]
    },
    %{addresses: [%{lines: nil}, %{lines: nil}]}
  ],
  dtypes: [{"addresses", {:list, {:struct, [{"lines", {:list, :string}}]}}}]
)

Expected

Either an error explaining that the lists can't be nil or the following:

#Explorer.DataFrame<
  Polars[3 x 1]
  addresses list[struct[1]] [
    [],
    [%{"lines" => ["Nadarzyn Mszczonowska 24"]}, %{"lines" => [...]}],
    [%{"lines" => []}, %{lines: []}]
  ]
>

Actual

thread '<unnamed>' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-core-0.42.0/src/named_from.rs:170:56:
called `Result::unwrap()` on an `Err` value: ComputeError(ErrString("dtypes don't match, got struct[1], expected: struct[1]"))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
** (ArgumentError) cannot create series "addresses": Erlang error: :nif_panicked
    (explorer 0.9.2) lib/explorer/polars_backend/data_frame.ex:578: Explorer.PolarsBackend.DataFrame.series_from_list!/3
    (explorer 0.9.2) lib/explorer/polars_backend/data_frame.ex:529: anonymous fn/3 in Explorer.PolarsBackend.DataFrame.from_tabular/2
    (elixir 1.17.2) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
    (explorer 0.9.2) lib/explorer/polars_backend/data_frame.ex:523: Explorer.PolarsBackend.DataFrame.from_tabular/2
    temp/trigger.exs:35: (file)

Runtime

  • Elixir 1.17.2
  • Erlang 27.0.1
  • Explorer 0.9.2

Potentially related to #857

@billylanchantin
Copy link
Member

Thanks for the report, @maennchen! We just merged a fix for this issue to main. Feel free to test it out now or wait until the next release.

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