-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: Emit warning with Diagnostic when doing = Null #15696
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?
Conversation
Hi @eliaperantoni, Thank you for your patience and guidance throughout this issue. I've implemented the core functionality per our discussions, but would like to confirm a few implementation details:
I appreciate your expertise in reviewing these implementation choices. Please let me know if any adjustments are needed. |
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 @changsun20 wondering if its possible to test those warnings in integration slt test files?
Thank you for the thoughtful question, @comphead. I appreciate your focus on validation through integration tests. The current implementation prioritizes unit testing for the diagnostic infrastructure itself, as the warnings are collected internally via I fully agree that end-to-end validation through If the community prefers earlier integration testing, I'm happy to explore interim solutions - perhaps a temporary hook for test validation. Let me know your preference, and I'll adapt accordingly. |
b7c80a2
to
85ecef1
Compare
Yeah, that was actually my question having the warnings without being returned to the end user, who is supposed to react on the warnings? 🤔 |
@comphead I understand your concern. If displaying warnings to end users is what you'd like to see in this PR, could you confirm if @eliaperantoni's proposed solution in #14434 of "replacing Result with DatafusionResult" aligns with what you're thinking? My concern is that this approach might be too invasive, since we're dealing with warnings that should be passed to the end without interrupting execution, rather than immediate errors. However, as discussed in the issue, this could be more robust long-term. Please share your thoughts and preference. If this is the direction the community chooses, I'll convert this PR to draft status and implement that approach later. |
Which issue does this PR close?
Closes #14434
Rationale for this change
This PR addresses a common SQL anti-pattern where users accidentally use
= NULL
instead ofIS NULL
. While syntactically valid, this comparison always returns NULL in SQL and often indicates a developer mistake. The changes help users identify this pitfall through rich warnings while maintaining full query execution capabilities.What changes are included in this PR?
= NULL
comparisons in predicate contextsIS NULL
alternativeAre these changes tested?
Yes, this PR includes:
= NULL
detectionAre there any user-facing changes?
Yes, but non-breaking. No API changes or behavior modifications - existing queries will still execute normally but may produce additional warnings.