You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/20 15:55:29 UTC

[GitHub] [doris] xy720 opened a new pull request, #11054: [feature-wip](array-type) add function array_slice

xy720 opened a new pull request, #11054:
URL: https://github.com/apache/doris/pull/11054

   # Proposed changes
   
   Issue Number: related to #10052
   
   array_slice returns a slice of the array.
   
   usage example
   
   ```
   mysql> set enable_vectorized_engine=true;
   
   mysql> select k2, array_slice(k2, 2, 2) from array_type_table_nullable;
   +-----------------+-------------------------+
   | k2              | array_slice(`k2`, 2, 2) |
   +-----------------+-------------------------+
   | [1, 2, 3]       | [2, 3]                  |
   | [1, NULL, 3]    | [NULL, 3]               |
   | [2, 3]          | [3]                     |
   | NULL            | NULL                    |
   +-----------------+-------------------------+
   
   mysql> select k2, array_slice(k2, 2, 2) from array_type_table_nullable_varchar;
   +----------------------------+-------------------------+
   | k2                         | array_slice(`k2`, 2, 2) |
   +----------------------------+-------------------------+
   | ['hello', 'world', 'c++']  | ['world', 'c++']        |
   | ['a1', 'equals', 'b1']     | ['equals', 'b1']        |
   | ['hasnull', NULL, 'value'] | [NULL, 'value']         |
   | ['hasnull', NULL, 'value'] | [NULL, 'value']         |
   +----------------------------+-------------------------+
   ```
   
   当指定off为负数:
   
   ```
   mysql> select k2, array_slice(k2, -2, 1) from array_type_table_two_array;
   +-----------+--------------------------+
   | k2        | array_slice(`k2`, -2, 1) |
   +-----------+--------------------------+
   | [1, 2, 3] | [2]                      |
   | [1, 2, 3] | [2]                      |
   | [2, 3]    | [2]                      |
   | [2, 3]    | [2]                      |
   +-----------+--------------------------+
   
   mysql> select k2, array_slice(k2, -2, 2) from array_type_table_two_array_nullable_varchar;
   +----------------------------+--------------------------+
   | k2                         | array_slice(`k2`, -2, 2) |
   +----------------------------+--------------------------+
   | ['hello', 'world', 'c++']  | ['world', 'c++']         |
   | ['a1', 'equals', 'b1']     | ['equals', 'b1']         |
   | ['hasnull', NULL, 'value'] | [NULL, 'value']          |
   | ['hasnull', NULL, 'value'] | [NULL, 'value']          |
   +----------------------------+--------------------------+
   ```
   
   ```
   mysql> select k2, array_slice(k2, 0) from array_type_table;
   +-----------+-------------------------+
   | k2        | array_slice(`k2`, 0, 1) |
   +-----------+-------------------------+
   | [1, 2, 3] | []                      |
   +-----------+-------------------------+
   
   mysql> select k2, array_slice(k2, -5) from array_type_table;
   +-----------+----------------------+
   | k2        | array_slice(`k2`, 0) |
   +-----------+----------------------+
   | [1, 2, 3] | []                   |
   +-----------+----------------------+
   ```
   
   
   ## Problem Summary:
   
   Describe the overview of changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: (Yes)
   2. Has unit tests been added: (Yes)
   3. Has document been added or modified: (Yes)
   4. Does it need to update dependencies: (No)
   5. Are there any changes that cannot be rolled back: (No)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] cambyzju commented on pull request #11054: [feature-wip](array-type) add function array_slice

Posted by GitBox <gi...@apache.org>.
cambyzju commented on PR #11054:
URL: https://github.com/apache/doris/pull/11054#issuecomment-1195518588

   LGTM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #11054: [feature-wip](array-type) add function array_slice

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #11054:
URL: https://github.com/apache/doris/pull/11054#issuecomment-1196563413

   PR approved by at least one committer and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] xy720 merged pull request #11054: [feature-wip](array-type) add function array_slice

Posted by GitBox <gi...@apache.org>.
xy720 merged PR #11054:
URL: https://github.com/apache/doris/pull/11054


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #11054: [feature-wip](array-type) add function array_slice

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #11054:
URL: https://github.com/apache/doris/pull/11054#issuecomment-1196563453

   PR approved by anyone and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org