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

Implement $to_dot() for LazyFrame #928

Merged
merged 12 commits into from
Mar 18, 2024
Merged

Implement $to_dot() for LazyFrame #928

merged 12 commits into from
Mar 18, 2024

Conversation

etiennebacher
Copy link
Collaborator

library(polars)

query = pl$LazyFrame(mtcars)$
  filter(pl$col("drat") > 3)$
  with_columns(foo = pl$col("mpg") + pl$col("cyl"), bar = pl$mean("mpg"))

query$show_graph(raw_output = TRUE) |> cat()
#> graph  polars_query {
#> "WITH COLUMNS [\"foo\",\"bar\"] [(0, 0)]" -- "TABLE
#> π */11;
#> σ (col(\"drat\")) > (3.0) [(0, 1)]"
#> 
#> "WITH COLUMNS [\"foo\",\"bar\"] [(0, 0)]"[label="WITH COLUMNS [\"foo\",\"bar\"]"]
#> "TABLE
#> π */11;
#> σ (col(\"drat\")) > (3.0) [(0, 1)]"[label="TABLE
#> π */11;
#> σ (col(\"drat\")) > (3.0)"]
#> 
#> }

query$show_graph(width = "400px")

@etiennebacher
Copy link
Collaborator Author

I don't understand why snapshots fail on some platforms only. @eitsupi can you reproduce some of those failures locally?

R/lazyframe__lazy.R Outdated Show resolved Hide resolved
tests/testthat/_snaps/lazy_profile/basic-query-graph.svg Outdated Show resolved Hide resolved
R/lazyframe__lazy.R Outdated Show resolved Hide resolved
@eitsupi
Copy link
Collaborator

eitsupi commented Mar 17, 2024

I don't understand why snapshots fail on some platforms only. @eitsupi can you reproduce some of those failures locally?

I found that running the function over and over did not always return the same result each time.

> query$show_graph(raw_output = TRUE) |> cat()
graph  polars_query {
"WITH COLUMNS [\"foo\",\"bar\"] [(0, 0)]" -- "TABLE
π */11;
σ (col(\"drat\")) > (3.0) [(0, 1)]"

"TABLE
π */11;
σ (col(\"drat\")) > (3.0) [(0, 1)]"[label="TABLE
π */11;
σ (col(\"drat\")) > (3.0)"]
"WITH COLUMNS [\"foo\",\"bar\"] [(0, 0)]"[label="WITH COLUMNS [\"foo\",\"bar\"]"]

}
> query$show_graph(raw_output = TRUE) |> cat()
graph  polars_query {
"WITH COLUMNS [\"foo\",\"bar\"] [(0, 0)]" -- "TABLE
π */11;
σ (col(\"drat\")) > (3.0) [(0, 1)]"

"WITH COLUMNS [\"foo\",\"bar\"] [(0, 0)]"[label="WITH COLUMNS [\"foo\",\"bar\"]"]
"TABLE
π */11;
σ (col(\"drat\")) > (3.0) [(0, 1)]"[label="TABLE
π */11;
σ (col(\"drat\")) > (3.0)"]

eitsupi and others added 5 commits March 17, 2024 15:44
Merge branch 'lazyframe_show_graph' of https://github.com/pola-rs/r-polars into lazyframe_show_graph

# Conflicts:
#	NEWS.md
#	R/lazyframe__lazy.R
#	man/LazyFrame_to_dot.Rd
#	tests/testthat/_snaps/lazy_profile.md
#	tests/testthat/test-lazy_profile.R
@etiennebacher etiennebacher changed the title Implement $show_graph() for LazyFrame Implement $to_dot() for LazyFrame Mar 18, 2024
Copy link
Collaborator

@eitsupi eitsupi left a comment

Choose a reason for hiding this comment

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

Thanks!

@eitsupi eitsupi merged commit b937e3e into main Mar 18, 2024
35 checks passed
@eitsupi eitsupi deleted the lazyframe_show_graph branch March 18, 2024 22:21
@eitsupi eitsupi mentioned this pull request Mar 19, 2024
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.

None yet

2 participants