Skip to content
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

NULLIF function is not NON_NULLABLE nor NULLABLE #15329

Merged
merged 1 commit into from Jan 11, 2024
Merged

Conversation

jeeminso
Copy link
Contributor

@jeeminso jeeminso commented Jan 11, 2024

Summary of the changes / Why this improves CrateDB

Fixes #15325

By definition

   - Nullable means the function returns a null value for a null argument.

   - Non-nullable means the function returns never a null values for null
     arguments.

   - Conditional means it follows it's own logic. By default each scalar
    function is conditional.

NULLIF is conditional.


Without the fix:

cr> SELECT * FROM t0 WHERE (NOT NULLIF((t0.c1), NULL));
+------+
| c1   |
+------+
| NULL |
+------+
SELECT 1 row in set (0.106 sec)

With the fix:

cr> SELECT * FROM t0 WHERE (NOT NULLIF((t0.c1), NULL));
+----+
| c1 |
+----+
+----+
SELECT 0 rows in set (3.826 sec)

Checklist

  • Added an entry in the latest docs/appendices/release-notes/<x.y.0>.rst for user facing changes
  • Updated documentation & sql_features table for user facing changes
  • Touched code is covered by tests
  • CLA is signed
  • This does not contain breaking changes, or if it does:
    • It is released within a major release
    • It is recorded in the latest docs/appendices/release-notes/<x.y.0>.rst
    • It was marked as deprecated in an earlier release if possible
    • You've thought about the consequences and other components are adapted
      (E.g. AdminUI)

@jeeminso jeeminso marked this pull request as ready for review January 11, 2024 16:26
Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

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

thx for the quick fix @jeeminso !

@jeeminso jeeminso added the ready-to-merge Let Mergify merge the PR once approved and checks pass label Jan 11, 2024
@mergify mergify bot merged commit e9fd37e into master Jan 11, 2024
16 checks passed
@mergify mergify bot deleted the jeeminso/fix-nullif branch January 11, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Let Mergify merge the PR once approved and checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected Results Using NULLIF with VARCHAR
2 participants