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

explain(streaming=True) isn't showing correct plan #16762

Closed
2 tasks done
Thomzoy opened this issue Jun 6, 2024 · 0 comments · Fixed by #16771
Closed
2 tasks done

explain(streaming=True) isn't showing correct plan #16762

Thomzoy opened this issue Jun 6, 2024 · 0 comments · Fixed by #16771
Assignees
Labels
accepted Ready for implementation bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@Thomzoy
Copy link

Thomzoy commented Jun 6, 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
pl.Config.set_streaming_chunk_size(2)

a = pl.LazyFrame(
            data=dict(
                a=[1,2,3,3],
            )
        )
b = pl.LazyFrame(
            data=dict(
                a=[1,2,3,3],
            )
        )

joined = a.join(b, on="a")
joined .explain(streaming=True)

Log output

STREAMING
  DF []; PROJECT */0 COLUMNS; SELECTION: None

Issue description

Description

When running a simple join on LazyFrames in a streaming fashion, the plan printed by explain seems to be incorrect

Example

import polars as pl
pl.Config.set_streaming_chunk_size(2)

a = pl.LazyFrame(
            data=dict(
                a=[1,2,3,3],
            )
        )
b = pl.LazyFrame(
            data=dict(
                a=[1,2,3,3],
            )
        )

joined = a.join(b, on="a")

joined .explain(streaming=False)

INNER JOIN:
LEFT PLAN ON: [col("a")]
  DF ["a"]; PROJECT */1 COLUMNS; SELECTION: None
RIGHT PLAN ON: [col("a")]
  DF ["a"]; PROJECT */1 COLUMNS; SELECTION: None
END INNER JOIN

joined .explain(streaming=True)

STREAMING
  DF []; PROJECT */0 COLUMNS; SELECTION: None

joined.collect(streaming=True)

However, collecting with streaming seems to display the correct streaming pipeline:

RUN STREAMING PIPELINE
[df -> callback -> ordered_sink, df -> generic_join_build]

Expected behavior

Display the correct plan

Installed versions

--------Version info---------
Polars:               0.20.31
Index type:           UInt32
Platform:             Linux-4.18.0-425.10.1.el8_7.x86_64-x86_64-with-glibc2.35
Python:               3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0]

----Optional dependencies----
adbc_driver_manager:  <not installed>
cloudpickle:          <not installed>
connectorx:           <not installed>
deltalake:            0.17.4
fastexcel:            <not installed>
fsspec:               2024.5.0
gevent:               <not installed>
hvplot:               <not installed>
matplotlib:           <not installed>
nest_asyncio:         1.6.0
numpy:                1.26.4
openpyxl:             <not installed>
pandas:               2.2.2
pyarrow:              16.1.0
pydantic:             <not installed>
pyiceberg:            <not installed>
pyxlsb:               <not installed>
sqlalchemy:           <not installed>
torch:                <not installed>
xlsx2csv:             <not installed>
xlsxwriter:           <not installed>
@Thomzoy Thomzoy added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jun 6, 2024
@coastalwhite coastalwhite self-assigned this Jun 6, 2024
coastalwhite added a commit to coastalwhite/polars that referenced this issue Jun 6, 2024
This PR adds back the possibility to `describe` / `explain` streaming engine
plans. As these plans are not stored in the main `IRPlan`, there need to be
special cases for that in each `describe` format.

This specifically addresses it for:
- Base format: Adds streaming header, prints the underlying plan
- Tree format: Adds streaming header into top node, prints the underlying plan
- Dot format: Prints the underlying plan

Fixes pola-rs#16762
coastalwhite added a commit to coastalwhite/polars that referenced this issue Jun 6, 2024
This PR adds back the possibility to `describe` / `explain` streaming engine
plans. As these plans are not stored in the main `IRPlan`, there need to be
special cases for that in each `describe` format.

This specifically addresses it for:
- Base format: Adds streaming header, prints the underlying plan
- Tree format: Adds streaming header into top node, prints the underlying plan
- Dot format: Prints the underlying plan

Fixes pola-rs#16762
coastalwhite added a commit to coastalwhite/polars that referenced this issue Jun 6, 2024
This PR adds back the possibility to `describe` / `explain` streaming engine
plans. As these plans are not stored in the main `IRPlan`, there need to be
special cases for that in each `describe` format.

This specifically addresses it for:
- Base format: Adds streaming header, prints the underlying plan
- Tree format: Adds streaming header into top node, prints the underlying plan
- Dot format: Prints the underlying plan

Fixes pola-rs#16762
coastalwhite added a commit to coastalwhite/polars that referenced this issue Jun 6, 2024
This PR adds back the possibility to `describe` / `explain` streaming engine
plans. As these plans are not stored in the main `IRPlan`, there need to be
special cases for that in each `describe` format.

This specifically addresses it for:
- Base format: Adds streaming header, prints the underlying plan
- Tree format: Adds streaming header into top node, prints the underlying plan
- Dot format: Prints the underlying plan

Fixes pola-rs#16762
coastalwhite added a commit to coastalwhite/polars that referenced this issue Jun 7, 2024
This PR adds back the possibility to `describe` / `explain` streaming engine
plans. As these plans are not stored in the main `IRPlan`, there need to be
special cases for that in each `describe` format.

This specifically addresses it for:
- Base format: Adds streaming header, prints the underlying plan
- Tree format: Adds streaming header into top node, prints the underlying plan
- Dot format: Prints the underlying plan

Fixes pola-rs#16762
@c-peters c-peters added the accepted Ready for implementation label Jun 9, 2024
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 needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants