Skip to content

SQL: Test and fix the NULL handling of the String functions (#68379)#68684

Merged
palesz merged 3 commits intoelastic:7.xfrom
palesz:string-fn-null-handling-7.x
Feb 8, 2021
Merged

SQL: Test and fix the NULL handling of the String functions (#68379)#68684
palesz merged 3 commits intoelastic:7.xfrom
palesz:string-fn-null-handling-7.x

Conversation

@palesz
Copy link
Copy Markdown
Contributor

@palesz palesz commented Feb 8, 2021

Fixed the inconsistencies regarding NULL argument handling.
NULL literal vs NULL field value as function arguments in some case
resulted in different function return values.

Functions should return with the same value no matter if the argument(s)
came from a field or from a literal.

The introduced integration test tests if function calls with same
argument values (regardless of literal/field) will return with the
same output (also checks if newly added functions are added to the
testcases).

Fixed the following functions:

  • Insert: NULL start, length and replacement arguments (as fields) also
    result in NULL return value instead of returning the input.
  • Locate: NULL pattern results in NULL return value, NULL optional start
    argument handled the same as missing start argument
  • Replace: NULL pattern and replacement results in NULL instead of
    returning the input
  • Substring: NULL start or length results in NULL instead of returning
    the input

Fixes #58907

(cherry-pick from a3dbdae)

…68379)

Fixed the inconsistencies regarding NULL argument handling.
NULL literal vs NULL field value as function arguments in some case
resulted in different function return values.

Functions should return with the same value no matter if the argument(s)
came from a field or from a literal.

The introduced integration test tests if function calls with same
argument values (regardless of literal/field) will return with the
same output (also checks if newly added functions are added to the
testcases).

Fixed the following functions:
* Insert: NULL start, length and replacement arguments (as fields) also
result in NULL return value instead of returning the input.
* Locate: NULL pattern results in NULL return value, NULL optional start
argument handled the same as missing start argument
* Replace: NULL pattern and replacement results in NULL instead of
returning the input
* Substring: NULL start or length results in NULL instead of returning
the input

Fixes elastic#58907
@palesz palesz added :Analytics/SQL SQL querying backport Team:QL (Deprecated) Meta label for query languages team v7.12.0 labels Feb 8, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-ql (Team:QL)

@palesz palesz merged commit 4413897 into elastic:7.x Feb 8, 2021
@palesz palesz deleted the string-fn-null-handling-7.x branch February 8, 2021 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/SQL SQL querying backport Team:QL (Deprecated) Meta label for query languages team v7.12.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants