Skip to content

Conversation

@CuteChuanChuan
Copy link
Contributor

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=true for the following datasource-related crates:

  • datafusion-spark
  • datafusion-sql
  • datafusion-sqllogictest
  • datafusion-substrait
  • datafusion-cli
  • datafusion-examples

Are 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.

@github-actions github-actions bot added sql SQL Planner sqllogictest SQL Logic Tests (.slt) substrait Changes to the substrait crate spark labels Nov 2, 2025
/// .unwrap()
/// .build()
/// .unwrap();
/// let sql = plan_to_sql(&plan).unwrap(); // convert to AST
Copy link
Member

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.

Copy link
Contributor Author

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!

Comment on lines 72 to 75
/// 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)")
Copy link
Contributor

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)

Comment on lines 72 to 77
/// let spans = get_spans(
/// "SELECT /*whole+left*/speed/*left*/ + /*right*/10/*right+whole*/ FROM cars",
/// );
/// // whole is ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/// // left is ^^^^^
/// // right is ^^
Copy link
Contributor

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

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

I took the liberty of fixing the issues identified by @Jefffrey and merging up from main

Thank you @CuteChuanChuan and @Weijun-H

@Jefffrey Jefffrey added this pull request to the merge queue Nov 7, 2025
Merged via the queue into apache:main with commit 969fc13 Nov 7, 2025
28 checks passed
@CuteChuanChuan
Copy link
Contributor Author

@alamb Thanks! ❤️

@alamb
Copy link
Contributor

alamb commented Nov 8, 2025

@alamb Thanks! ❤️

Thank you for working on this project!

hsiang-c pushed a commit to hsiang-c/datafusion that referenced this pull request Nov 9, 2025
…strait (apache#18443)

## Which issue does this PR close?
Part of apache#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=true`
for the following datasource-related crates:
  - `datafusion-spark`
  - `datafusion-sql`
  - `datafusion-sqllogictest`
  - `datafusion-substrait`
  - `datafusion-cli`
  - `datafusion-examples`

## Are 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.

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
codetyri0n pushed a commit to codetyri0n/datafusion that referenced this pull request Nov 11, 2025
…strait (apache#18443)

## Which issue does this PR close?
Part of apache#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=true`
for the following datasource-related crates:
  - `datafusion-spark`
  - `datafusion-sql`
  - `datafusion-sqllogictest`
  - `datafusion-substrait`
  - `datafusion-cli`
  - `datafusion-examples`

## Are 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.

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spark sql SQL Planner sqllogictest SQL Logic Tests (.slt) substrait Changes to the substrait crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants