Skip to content

Conversation

@goldmedal
Copy link
Contributor

Which issue does this PR close?

Closes #10519

Rationale for this change

What changes are included in this PR?

I found that is_not_null has been supported. I only implement 'is_null` here.

Are these changes tested?

Yes, I also added more test cases for is_null and is_not_null (e.g. function call and case when).

Are there any user-facing changes?

No

@github-actions github-actions bot added the sql SQL Planner label May 15, 2024
alamb
alamb previously approved these changes May 15, 2024
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.

Thank you for the contribution @goldmedal -- this code looks like a great first contribution.

I just kicked off the CI checks and once we get them to pass successfully I'll merge this PR in

Expr::IsNull(expr) => {
Ok(ast::Expr::IsNull(Box::new(self.expr_to_sql(expr)?)))
}
Expr::IsNotFalse(_) => not_impl_err!("Unsupported Expr conversion: {expr:?}"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah it looks like I maybe mis read the code originally and the other missing expression is Expr::IsNotFalse (rather than Expr::IsNotNull)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for reviewing! I think I can fix IsNotFalse in another PR. What do you think?

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 a second PR will be great

Copy link
Contributor

@yyy1000 yyy1000 left a comment

Choose a reason for hiding this comment

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

LGTM.
You need to run 'cargo fmt' to format the code,
also I think these additional test cases may not be necessary but it's good to keep them.

@alamb alamb dismissed their stale review May 15, 2024 19:33

CI is failing, let's wait for a clean run

@alamb
Copy link
Contributor

alamb commented May 15, 2024

Thanks again @goldmedal -- welcome to the project!

@alamb alamb merged commit eddec8e into apache:main May 15, 2024
@goldmedal goldmedal deleted the feature/10519-unparse-is-null branch May 16, 2024 01:08
findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 2024
…0529)

* implement unparse is_null and add test

* format the code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sql SQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IsNull / IsNotNull Expr --> String Support

3 participants