-
Notifications
You must be signed in to change notification settings - Fork 1.7k
chore: Format examples in doc strings - spark, sql, sqllogictest, sibstrait #18443
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
base: main
Are you sure you want to change the base?
chore: Format examples in doc strings - spark, sql, sqllogictest, sibstrait #18443
Conversation
datafusion/sql/src/unparser/plan.rs
Outdated
| /// .unwrap() | ||
| /// .build() | ||
| /// .unwrap(); | ||
| /// let sql = plan_to_sql(&plan).unwrap(); // convert to AST |
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.
It would be better to move // convert to AST to a new line.
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.
Hi @Weijun-H ,
thanks for the feedback! I've moved the // convert to AST comment to a new line.
PTAL when you get a chance. Thanks!
| /// let expr = col("a").gt(lit(4)); // form an expression `a > 4` | ||
| /// let sql = expr_to_sql(&expr).unwrap(); // convert to ast::Expr | ||
| /// // use the Display impl to convert to SQL text | ||
| /// // use the Display impl to convert to SQL text | ||
| /// assert_eq!(sql.to_string(), "(a > 4)") |
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.
This looks funky; might need to move that display comment to be at the end of the assert_eq line or otherwise move all comments to their own line (before their related line of code)
| /// let spans = get_spans( | ||
| /// "SELECT /*whole+left*/speed/*left*/ + /*right*/10/*right+whole*/ FROM cars", | ||
| /// ); | ||
| /// // whole is ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| /// // left is ^^^^^ | ||
| /// // right is ^^ |
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 think the comments below need to be adjusted as they were referring to the original format
Which issue does this PR close?
Part of #16915
Rationale for this change
Format code examples in documentation comments to improve readability and maintain consistent code style across the codebase. This is part of a multi-PR effort to format all doc comment examples and eventually enable CI checks to enforce this formatting.
What changes are included in this PR?
Run
cargo fmt -p <crate> -- --config format_code_in_doc_comments=truefor the following datasource-related crates:datafusion-sparkdatafusion-sqldatafusion-sqllogictestdatafusion-substraitdatafusion-clidatafusion-examplesAre these changes tested?
No testing needed - this is purely a formatting change with no functional modifications.
Are there any user-facing changes?
No - this only affects documentation formatting.