-
Notifications
You must be signed in to change notification settings - Fork 9
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
partiql-visualize-dot: add #438
Conversation
Extract code from `partiql-rust-cli/src/visualize` Signed-off-by: Rajiv Ranganath <[email protected]>
To add further context, here is how I was able to visualize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the addition! The PartiQL Rust team is ok w/ moving the partiql-rust-cli dot visualization over. Since this visualization code was part of the experimental partiql-rust-cli, we would prefer if it was under the extension
directory and also be behind a features
flag.
Could you also add
- An entry to the CHANGELOG for this addition
- A brief README for this new crate, containing some of the verbiage from the partiql-rust-cli about this crate being experimental, subject to change, etc.
Once those are added and the other comments are addressed, we should be good to approve your PR.
partiql-visualize-dot/Cargo.toml
Outdated
[dependencies] | ||
partiql-ast = { path = "../partiql-ast", version = "0.5.*" } | ||
partiql-logical = { path = "../partiql-logical", version = "0.5.*" } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you put a features
section for dot visualization and call it something like visualize-dot
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not entirely clear how adding visualize-dot
to features
would be helpful. Please allow me to explain and let me know your thoughts.
From what I can make out, the code in partiql-rust-cli/src/visualize
creates an output in dot
format, using dot-writer
crate.
It then uses other crates to support rendering in different formats, such as png, svg, etc.,
In the current PR, I've only extracted the code to just create dot
output. I am guessing when we add support for png, svg output, those can be behind feature flags in order to minimize the dependency graph?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry perhaps I should have added more detail in my initial comment. Since the dot visualization of the logical plan is still experimental / a PoC, we'd like to put the new functions and structures behind a feature similar to what was done for partiql-ast
's serde
feature:
partiql-ast
feature forserde
:partiql-lang-rust/partiql-ast/Cargo.toml
Lines 31 to 36 in b9a8885
serde = [ "dep:serde", "rust_decimal/serde-with-str", "rust_decimal/serde", "indexmap/serde", ] - example of using a
cfg
expression to conditionally include code whenserde
feature is enabled:partiql-lang-rust/partiql-ast/src/ast.rs
Line 24 in b9a8885
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
With how we had defined the serde
feature, the above code would only be compiled and built when the serde
feature is specified (or --all-features
). We would like something similar for partiql-extension-visualize
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added visualize-dot
feature. Please review.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #438 +/- ##
==========================================
- Coverage 81.91% 79.00% -2.91%
==========================================
Files 63 65 +2
Lines 16718 17333 +615
Branches 16718 17333 +615
==========================================
Hits 13694 13694
- Misses 2460 3075 +615
Partials 564 564
☔ View full report in Codecov by Sentry. |
Signed-off-by: Rajiv Ranganath <[email protected]>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for applying the comments. Changes since first review look good (and thanks for merging/rebasing off of main
!). I left a followup to the features
comment from the prior review. Once that's resolved, think this is ready to merge.
Signed-off-by: Rajiv Ranganath <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for the PR!
Ignoring coverage CI failure since this is experimental/PoC. |
Extract code from
partiql-rust-cli/src/visualize
Issue #, if available:
Description of changes:
As mentioned here, I have tried to extract code from
partiql-rust-cli/src/visualize
, so we can easily use it in our tests and other places.One way of using it might be as follows.
In
Cargo.toml
And then within a test we can do
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.