You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "eldenmoon (via GitHub)" <gi...@apache.org> on 2023/06/01 03:08:01 UTC

[GitHub] [doris] eldenmoon commented on a diff in pull request #20294: [Feature](array-functions)improve array functions for array_last_index

eldenmoon commented on code in PR #20294:
URL: https://github.com/apache/doris/pull/20294#discussion_r1212512384


##########
be/src/vec/functions/array/function_array_lambda_index.cpp:
##########
@@ -45,11 +45,12 @@ class FunctionContext;
 namespace doris::vectorized {
 
 // array_first_index([0, 1, 0]) -> [2]

Review Comment:
   add `array_last_index` annotation like `array_first_index`



##########
be/src/vec/functions/array/function_array_lambda_index.cpp:
##########
@@ -45,11 +45,12 @@ class FunctionContext;
 namespace doris::vectorized {
 
 // array_first_index([0, 1, 0]) -> [2]
-class FunctionArrayFirstIndex : public IFunction {
+template <bool first>
+class FunctionArrayLambdaIndex : public IFunction {
 public:

Review Comment:
   if this class is just for `array_first_index` `array_last_index`, so i think this class could be renamed to `FunctionArrayFirstOrLastIndex` is better?  Or we need some enum



##########
be/src/vec/functions/array/function_array_lambda_index.cpp:
##########
@@ -88,10 +89,21 @@ class FunctionArrayFirstIndex : public IFunction {
 
             // default index is 0 if such index is not found
             size_t first_index = 0;

Review Comment:
   rename first_index -> dst_index



-- 
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