Skip to content

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented May 20, 2024

Which issue does this PR close?

Follow on to #10558 from @xinlifoobar (🙏 ) and @edmondop

Rationale for this change

I noticed a few potential improvements to the sql_to_plan examples

What changes are included in this PR?

  1. Improve the documentation and function names to make the examples better in my opinion

Are these changes tested?

Existing CI

Are there any user-facing changes?

@alamb alamb marked this pull request as ready for review May 20, 2024 17:47
let expr = col("a").lt(lit(5)).or(col("a").eq(lit(8)));
let ast = expr_to_sql(&expr)?;
let sql = format!("{}", ast);
let sql = expr_to_sql(&expr)?.to_string();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it makes it easier to use this example if we don't have to worry about the intermediate ast as much, so I combined it into a single statement

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't remember why I had to do it, that totally makes sense

Copy link
Contributor

@edmondop edmondop left a comment

Choose a reason for hiding this comment

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

Looks good, thank you!

let expr = col("a").lt(lit(5)).or(col("a").eq(lit(8)));
let ast = expr_to_sql(&expr)?;
let sql = format!("{}", ast);
let sql = expr_to_sql(&expr)?.to_string();
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't remember why I had to do it, that totally makes sense

Copy link
Contributor

@edmondop edmondop left a comment

Choose a reason for hiding this comment

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

Looks good, thank you!

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

lgtm thanks @alamb and @edmondop for review

@comphead comphead merged commit e893a2e into apache:main May 22, 2024
@alamb alamb deleted the alamb/improve_example_docs branch May 22, 2024 17:49
findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 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.

3 participants