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

.arr.explode() fails to raise error for non-Array inputs #19049

Open
2 tasks done
cmdlineluser opened this issue Oct 1, 2024 · 4 comments · May be fixed by #19163
Open
2 tasks done

.arr.explode() fails to raise error for non-Array inputs #19049

cmdlineluser opened this issue Oct 1, 2024 · 4 comments · May be fixed by #19163
Labels
accepted Ready for implementation bug Something isn't working P-medium Priority: medium python Related to Python Polars

Comments

@cmdlineluser
Copy link
Contributor

cmdlineluser commented Oct 1, 2024

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

df = pl.DataFrame({"a": [[1, 2, 3]]})

df.select(pl.col.a.arr.explode())
# shape: (3, 1)
# ┌─────┐
# │ a   │
# │ --- │
# │ i64 │
# ╞═════╡
# │ 1   │
# │ 2   │
# │ 3   │
# └─────┘

Log output

No response

Issue description

Update: Perhaps a better example is using string inputs:

pl.DataFrame({"a": ["one"]}).select(pl.col.a.arr.explode())
# shape: (1, 1)
# ┌─────┐
# │ a   │
# │ --- │
# │ str │
# ╞═════╡
# │ one │
# └─────┘

Other methods error as expected:

df.select(pl.col.a.arr.to_struct())

# InvalidOperationError: expected Array type, got: list[i64]
# 
# Resolved plan until failure:
# 
# 	---> FAILED HERE RESOLVING 'select' <---
# DF ["a"]; PROJECT */1 COLUMNS; SELECTION: None

Expected behavior

InvalidOperationError

Installed versions

main
@cmdlineluser cmdlineluser added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Oct 1, 2024
@orlp orlp added accepted Ready for implementation P-medium Priority: medium and removed needs triage Awaiting prioritization by a maintainer labels Oct 2, 2024
@barak1412
Copy link
Contributor

@orlp
May you please clear @ritchie46 comment here #19115?

@orlp
Copy link
Collaborator

orlp commented Oct 7, 2024

@barak1412 I don't understand what you're asking.

@barak1412
Copy link
Contributor

@orlp thanks, @ritchie46 answered me

@barak1412
Copy link
Contributor

@orlp May you please assign me? I hope I will open PR today evening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation bug Something isn't working P-medium Priority: medium python Related to Python Polars
Projects
Status: Ready
3 participants