-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
branch-3.0: [fix](function) fixed some nested type func's param type which is not suitable and make result wrong #44923 #45296
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… suitable and make result wrong (#44923) nereids funcs signature for some nested type func's param type defined not right which will make result wrong such as ``` mysql> SELECT array_position([1,258],257),array_position([2],258); +-------------------------------+-------------------------------------------+ | array_position([1, 258], 257) | array_position([2], cast(258 as TINYINT)) | +-------------------------------+-------------------------------------------+ | 0 | 1 | +-------------------------------+-------------------------------------------+ 1 row in set (0.14 sec) mysql> select array_apply([258], '>' , 257), array_apply([1,2,3], '>', 258); +------------------------------+---------------------------------------------------+ | array_apply([258], '>', 257) | array_apply([1, 2, 3], '>', cast(258 as TINYINT)) | +------------------------------+---------------------------------------------------+ | [258] | [3] | +------------------------------+---------------------------------------------------+ 1 row in set (0.11 sec) mysql> select array_contains([258], 257), array_contains([1,2,3], 258); +----------------------------+-------------------------------------------------+ | array_contains([258], 257) | array_contains([1, 2, 3], cast(258 as TINYINT)) | +----------------------------+-------------------------------------------------+ | 0 | 1 | +----------------------------+-------------------------------------------------+ 1 row in set (0.12 sec) mysql> mysql> select array_pushfront([258], 257), array_pushfront([1,2,3], 258); +-----------------------------+--------------------------------------------------+ | array_pushfront([258], 257) | array_pushfront([1, 2, 3], cast(258 as TINYINT)) | +-----------------------------+--------------------------------------------------+ | [257, 258] | [2, 1, 2, 3] | +-----------------------------+--------------------------------------------------+ 1 row in set (0.12 sec) mysql> select array_pushback([1,258], 257), array_pushback([1,2,3], 258); +-------------------------------+-------------------------------------------------+ | array_pushback([1, 258], 257) | array_pushback([1, 2, 3], cast(258 as TINYINT)) | +-------------------------------+-------------------------------------------------+ | [1, 258, 257] | [1, 2, 3, 2] | +-------------------------------+-------------------------------------------------+ 1 row in set (0.10 sec) mysql> select array_remove([1,258], 257), array_remove([1,2,3], 258); +-----------------------------+-----------------------------------------------+ | array_remove([1, 258], 257) | array_remove([1, 2, 3], cast(258 as TINYINT)) | +-----------------------------+-----------------------------------------------+ | [1, 258] | [1, 3] | +-----------------------------+-----------------------------------------------+ 1 row in set (0.12 sec) mysql> select map_contains_key(map(1,258), 257), map_contains_key(map(1,2), 258); +-----------------------------------------------------+---------------------------------------------------+ | map_contains_key(map(1, 258), cast(257 as TINYINT)) | map_contains_key(map(1, 2), cast(258 as TINYINT)) | +-----------------------------------------------------+---------------------------------------------------+ | 1 | 0 | +-----------------------------------------------------+---------------------------------------------------+ 1 row in set (0.12 sec) mysql> select map_contains_key(map(1,258), 257), map_contains_key(map(1,3), 258); +-----------------------------------------------------+---------------------------------------------------+ | map_contains_key(map(1, 258), cast(257 as TINYINT)) | map_contains_key(map(1, 3), cast(258 as TINYINT)) | +-----------------------------------------------------+---------------------------------------------------+ | 1 | 0 | +-----------------------------------------------------+---------------------------------------------------+ 1 row in set (0.11 sec) mysql> select map_contains_key(map(1,258), 257), map_contains_key(map(3,1), 258); +-----------------------------------------------------+---------------------------------------------------+ | map_contains_key(map(1, 258), cast(257 as TINYINT)) | map_contains_key(map(3, 1), cast(258 as TINYINT)) | +-----------------------------------------------------+---------------------------------------------------+ | 1 | 0 | +-----------------------------------------------------+---------------------------------------------------+ ``` but true result is ``` mysql> SELECT array_position([1,258],257),array_position([2],258); +-------------------------------+---------------------------------------------------+ | array_position([1, 258], 257) | array_position(cast([2] as ARRAY<SMALLINT>), 258) | +-------------------------------+---------------------------------------------------+ | 0 | 0 | +-------------------------------+---------------------------------------------------+ 1 row in set (0.73 sec) mysql> select array_apply([258], '>' , 257), array_apply([1,2,3], '>', 258); +------------------------------+-----------------------------------------------------------+ | array_apply([258], '>', 257) | array_apply(cast([1, 2, 3] as ARRAY<SMALLINT>), '>', 258) | +------------------------------+-----------------------------------------------------------+ | [258] | [] | +------------------------------+-----------------------------------------------------------+ 1 row in set (0.10 sec) mysql> select array_contains([258], 257), array_contains([1,2,3], 258); +----------------------------+---------------------------------------------------------+ | array_contains([258], 257) | array_contains(cast([1, 2, 3] as ARRAY<SMALLINT>), 258) | +----------------------------+---------------------------------------------------------+ | 0 | 0 | +----------------------------+---------------------------------------------------------+ 1 row in set (0.09 sec) mysql> select array_pushfront([258], 257), array_pushfront([1,2,3], 258); +-----------------------------+----------------------------------------------------------+ | array_pushfront([258], 257) | array_pushfront(cast([1, 2, 3] as ARRAY<SMALLINT>), 258) | +-----------------------------+----------------------------------------------------------+ | [257, 258] | [258, 1, 2, 3] | +-----------------------------+----------------------------------------------------------+ 1 row in set (0.11 sec) mysql> select array_remove([1,258], 257), array_remove([1,2,3], 258); +-----------------------------+-------------------------------------------------------+ | array_remove([1, 258], 257) | array_remove(cast([1, 2, 3] as ARRAY<SMALLINT>), 258) | +-----------------------------+-------------------------------------------------------+ | [1, 258] | [1, 2, 3] | +-----------------------------+-------------------------------------------------------+ 1 row in set (0.09 sec) mysql> select countequal([1,258], 257), array_count_equal([1,2,3], 258); ERROR 1105 (HY000): errCode = 2, detailMessage = Can not found function 'array_count_equal' mysql> select countequal([1,258], 257), countequal([1,2,3], 258); +---------------------------+-----------------------------------------------------+ | countequal([1, 258], 257) | countequal(cast([1, 2, 3] as ARRAY<SMALLINT>), 258) | +---------------------------+-----------------------------------------------------+ | 0 | 0 | +---------------------------+-----------------------------------------------------+ 1 row in set (0.08 sec) mysql> select map_contains_key(map(1,258), 257), map_contains_key(map(2,1), 258); +--------------------------------------------------------------------+-----------------------------------------------------------------+ | map_contains_key(cast(map(1, 258) as MAP<SMALLINT,SMALLINT>), 257) | map_contains_key(cast(map(2, 1) as MAP<SMALLINT,TINYINT>), 258) | +--------------------------------------------------------------------+-----------------------------------------------------------------+ | 0 | 0 | +--------------------------------------------------------------------+-----------------------------------------------------------------+ 1 row in set (0.09 sec) mysql> select map_contains_value(map(1,1), 257), map_contains_value(map(1,2), 258); +-------------------------------------------------------------------+-------------------------------------------------------------------+ | map_contains_value(cast(map(1, 1) as MAP<TINYINT,SMALLINT>), 257) | map_contains_value(cast(map(1, 2) as MAP<TINYINT,SMALLINT>), 258) | +-------------------------------------------------------------------+-------------------------------------------------------------------+ | 0 | 0 | +-------------------------------------------------- ```
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
run buildall |
morrySnow
approved these changes
Dec 23, 2024
PR approved by at least one committer and no changes requested. |
github-actions
bot
added
the
approved
Indicates a PR has been approved by one committer.
label
Dec 23, 2024
PR approved by anyone and no changes requested. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-picked from #44923