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

join on a literal causes segfault when either frame has 0 rows. #17027

Closed
2 tasks done
cmdlineluser opened this issue Jun 17, 2024 · 1 comment · Fixed by #17047
Closed
2 tasks done

join on a literal causes segfault when either frame has 0 rows. #17027

cmdlineluser opened this issue Jun 17, 2024 · 1 comment · Fixed by #17047
Assignees
Labels
A-panic Area: code that results in panic exceptions accepted Ready for implementation bug Something isn't working needs triage Awaiting prioritization by a maintainer P-medium Priority: medium python Related to Python Polars

Comments

@cmdlineluser
Copy link
Contributor

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

import polars as pl

df1 = pl.DataFrame({"a": [1]})
df2 = pl.DataFrame(schema={"b": pl.Int64})

df1.join(df2, on=pl.lit("c"))
# zsh: segmentation fault 

Log output

join parallel: true

Issue description

Just while trying to reproduce #9711 I ended up with a segfault for a reduced example.

Expected behavior

No segfault.

Installed versions

--------Version info---------
Polars:               1.0.0-alpha.1
Index type:           UInt32
Platform:             macOS-13.6.1-arm64-arm-64bit
Python:               3.12.2 (main, Feb  6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)]

----Optional dependencies----
adbc_driver_manager:  <not installed>
cloudpickle:          <not installed>
connectorx:           <not installed>
deltalake:            <not installed>
fastexcel:            <not installed>
fsspec:               <not installed>
gevent:               <not installed>
hvplot:               <not installed>
matplotlib:           <not installed>
nest_asyncio:         <not installed>
numpy:                1.26.4
openpyxl:             <not installed>
pandas:               2.2.1
pyarrow:              15.0.2
pydantic:             <not installed>
pyiceberg:            <not installed>
sqlalchemy:           <not installed>
torch:                <not installed>
xlsx2csv:             <not installed>
xlsxwriter:           <not installed>
@cmdlineluser cmdlineluser added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jun 17, 2024
@coastalwhite
Copy link
Collaborator

Here is a backtrace of the get_unchecked going wrong.

thread 'polars-0' panicked at library/core/src/panicking.rs:219:5:
unsafe precondition(s) violated: slice::get_unchecked requires that the index is within the slice
stack backtrace:
   0: rust_begin_unwind
             at /rustc/ab14f944afe4234db378ced3801e637eae6c0f30/library/std/src/panicking.rs:652:5
   1: core::panicking::panic_nounwind_fmt::runtime
             at /rustc/ab14f944afe4234db378ced3801e637eae6c0f30/library/core/src/panicking.rs:110:18
   2: core::panicking::panic_nounwind_fmt
             at /rustc/ab14f944afe4234db378ced3801e637eae6c0f30/library/core/src/panicking.rs:120:5
   3: core::panicking::panic_nounwind
             at /rustc/ab14f944afe4234db378ced3801e637eae6c0f30/library/core/src/panicking.rs:219:5
   4: <usize as core::slice::index::SliceIndex<[T]>>::get_unchecked::precondition_check
             at /rustc/ab14f944afe4234db378ced3801e637eae6c0f30/library/core/src/ub_checks.rs:68:21
   5: <usize as core::slice::index::SliceIndex<[T]>>::get_unchecked
             at /rustc/ab14f944afe4234db378ced3801e637eae6c0f30/library/core/src/ub_checks.rs:75:17
   6: core::slice::<impl [T]>::get_unchecked
             at /rustc/ab14f944afe4234db378ced3801e637eae6c0f30/library/core/src/slice/mod.rs:686:20
   7: polars_core::chunked_array::ops::gather::gather_idx_array_unchecked::{{closure}}
             at ./crates/polars-core/src/chunked_array/ops/gather.rs:126:24
   8: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /rustc/ab14f944afe4234db378ced3801e637eae6c0f30/library/core/src/ops/function.rs:305:13
   9: core::option::Option<T>::map
             at /rustc/ab14f944afe4234db378ced3801e637eae6c0f30/library/core/src/option.rs:1072:29

@coastalwhite coastalwhite added P-medium Priority: medium A-panic Area: code that results in panic exceptions labels Jun 18, 2024
@ritchie46 ritchie46 self-assigned this Jun 18, 2024
@c-peters c-peters added the accepted Ready for implementation label Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-panic Area: code that results in panic exceptions accepted Ready for implementation bug Something isn't working needs triage Awaiting prioritization by a maintainer P-medium Priority: medium python Related to Python Polars
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants