You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "david990917 (via GitHub)" <gi...@apache.org> on 2023/04/22 10:57:27 UTC

[GitHub] [doris] david990917 opened a new pull request, #18931: [feature](array_function) add support for array_contains_any

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

   # Proposed changes
   
   Issue Number: #17361
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [ ] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## 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] github-actions[bot] commented on pull request #18931: [feature](array_function) add support for array_contains_any

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18931:
URL: https://github.com/apache/doris/pull/18931#issuecomment-1547595773

   clang-tidy review says "All clean, LGTM! :+1:"


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


Re: [PR] [feature](array_function) add support for array_contains_any [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #18931: [feature](array_function) add support for array_contains_any
URL: https://github.com/apache/doris/pull/18931


-- 
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 #18931: [feature](array_function) add support for array_contains_any

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18931:
URL: https://github.com/apache/doris/pull/18931#issuecomment-1529139402

   clang-tidy review says "All clean, LGTM! :+1:"


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


Re: [PR] [feature](array_function) add support for array_contains_any [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18931:
URL: https://github.com/apache/doris/pull/18931#issuecomment-1806950816

   We're closing this PR because it hasn't been updated in a while.
   This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you'd like to revive this PR, please reopen it and feel free a maintainer to remove the Stale tag!


-- 
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 a diff in pull request #18931: [feature](array_function) add support for array_contains_any

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18931:
URL: https://github.com/apache/doris/pull/18931#discussion_r1174387523


##########
be/src/vec/functions/array/function_array_contains_any.cpp:
##########
@@ -0,0 +1,71 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <string_view>
+
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_string.h"
+#include "vec/common/string_ref.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/functions/array/function_array_utils.h"
+#include "vec/functions/function.h"
+#include "vec/functions/simple_function_factory.h"
+
+namespace doris::vectorized {
+
+// array_contains_any([1, 2, 3, 10], [2,5]) -> true
+class FunctionArrayContainsAny : public IFunction {
+public:
+    static constexpr auto name = "array_contains_any";
+    static FunctionPtr create() { return std::make_shared<FunctionArrayContainsAny>(); }
+
+    String get_name() const override { return name; }
+    bool is_variadic() const override { return false; }
+
+    DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
+        DCHECK(arguments.size() > 0)
+                << "function: " << get_name() << ", arguments should not be empty";
+        for (const auto& arg : arguments) {
+            DCHECK(is_array(arg)) << "argument for function array_concat should be DataTypeArray"
+                                  << " and argument is " << arg->get_name();
+        }
+        return arguments[0];
+    }
+
+    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& argument,
+                        size_t result, size_t input_rows_count) override {
+        DataTypePtr column_type = block.get_by_position(argument[0]).type;
+        auto nested_type = assert_cast<const DataTypeArray&>(*column_type).get_nested_type();
+
+        ColumnPtr src_column0 =
+                block.get_by_position(argument[0]).column->convert_to_full_column_if_const();
+        const auto& src_column_array0 = check_and_get_column<ColumnArray>(*src_column0);
+
+        ColumnPtr src_column1 =
+                block.get_by_position(argument[1]).column->convert_to_full_column_if_const();
+        const auto& src_column_array1 = check_and_get_column<ColumnArray>(*src_column1);

Review Comment:
   warning: unused variable 'src_column_array1' [clang-diagnostic-unused-variable]
   ```cpp
           const auto& src_column_array1 = check_and_get_column<ColumnArray>(*src_column1);
                       ^
   ```
   



##########
be/src/vec/functions/array/function_array_contains_any.cpp:
##########
@@ -0,0 +1,71 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <string_view>
+
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_string.h"
+#include "vec/common/string_ref.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/functions/array/function_array_utils.h"
+#include "vec/functions/function.h"
+#include "vec/functions/simple_function_factory.h"
+
+namespace doris::vectorized {
+
+// array_contains_any([1, 2, 3, 10], [2,5]) -> true
+class FunctionArrayContainsAny : public IFunction {
+public:
+    static constexpr auto name = "array_contains_any";
+    static FunctionPtr create() { return std::make_shared<FunctionArrayContainsAny>(); }
+
+    String get_name() const override { return name; }
+    bool is_variadic() const override { return false; }
+
+    DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
+        DCHECK(arguments.size() > 0)
+                << "function: " << get_name() << ", arguments should not be empty";
+        for (const auto& arg : arguments) {
+            DCHECK(is_array(arg)) << "argument for function array_concat should be DataTypeArray"
+                                  << " and argument is " << arg->get_name();
+        }
+        return arguments[0];
+    }
+
+    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& argument,
+                        size_t result, size_t input_rows_count) override {
+        DataTypePtr column_type = block.get_by_position(argument[0]).type;
+        auto nested_type = assert_cast<const DataTypeArray&>(*column_type).get_nested_type();
+
+        ColumnPtr src_column0 =
+                block.get_by_position(argument[0]).column->convert_to_full_column_if_const();
+        const auto& src_column_array0 = check_and_get_column<ColumnArray>(*src_column0);

Review Comment:
   warning: unused variable 'src_column_array0' [clang-diagnostic-unused-variable]
   ```cpp
           const auto& src_column_array0 = check_and_get_column<ColumnArray>(*src_column0);
                       ^
   ```
   



-- 
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] david990917 commented on pull request #18931: [feature](array_function) add support for array_contains_any

Posted by "david990917 (via GitHub)" <gi...@apache.org>.
david990917 commented on PR #18931:
URL: https://github.com/apache/doris/pull/18931#issuecomment-1547844054

   please run the tests in the pipeline


-- 
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 a diff in pull request #18931: [feature](array_function) add support for array_contains_any

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18931:
URL: https://github.com/apache/doris/pull/18931#discussion_r1174418359


##########
be/src/vec/functions/array/function_array_contains_any.cpp:
##########
@@ -0,0 +1,236 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <string_view>
+
+#include "function_arrays_overlap.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_string.h"
+#include "vec/common/string_ref.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/functions/array/function_array_utils.h"
+#include "vec/functions/function.h"
+#include "vec/functions/simple_function_factory.h"
+
+namespace doris::vectorized {
+
+
+// array_contains_any([1, 2, 3, 10], [2,5]) -> true
+class FunctionArrayContainsAny : public IFunction {
+public:
+    static constexpr auto name = "array_contains_any";
+    static FunctionPtr create() { return std::make_shared<FunctionArrayContainsAny>(); }
+
+    String get_name() const override { return name; }
+
+    bool use_default_implementation_for_nulls() const override { return false; }
+
+    bool is_variadic() const override { return false; }
+
+    size_t gget_number_of_arguments() const override {return 2}

Review Comment:
   warning: only virtual member functions can be marked 'override' [clang-diagnostic-error]
   
   ```suggestion
       size_t gget_number_of_arguments() const {return 2}
   ```
   



##########
be/src/vec/functions/array/function_array_contains_any.cpp:
##########
@@ -0,0 +1,236 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <string_view>
+
+#include "function_arrays_overlap.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_string.h"
+#include "vec/common/string_ref.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/functions/array/function_array_utils.h"
+#include "vec/functions/function.h"
+#include "vec/functions/simple_function_factory.h"
+
+namespace doris::vectorized {
+
+
+// array_contains_any([1, 2, 3, 10], [2,5]) -> true
+class FunctionArrayContainsAny : public IFunction {
+public:
+    static constexpr auto name = "array_contains_any";
+    static FunctionPtr create() { return std::make_shared<FunctionArrayContainsAny>(); }
+
+    String get_name() const override { return name; }
+
+    bool use_default_implementation_for_nulls() const override { return false; }
+
+    bool is_variadic() const override { return false; }
+
+    size_t gget_number_of_arguments() const override {return 2}

Review Comment:
   warning: expected ';' after return statement [clang-diagnostic-error]
   
   ```suggestion
       size_t gget_number_of_arguments() const override {return 2;}
   ```
   



-- 
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 #18931: [feature](array_function) add support for array_contains_any

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18931:
URL: https://github.com/apache/doris/pull/18931#issuecomment-1518602531

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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 #18931: [feature](array_function) add support for array_contains_any

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18931:
URL: https://github.com/apache/doris/pull/18931#issuecomment-1518665167

   clang-tidy review says "All clean, LGTM! :+1:"


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