HappenLee commented on code in PR #13581:
URL: https://github.com/apache/doris/pull/13581#discussion_r1017634553


##########
be/src/vec/exprs/vdirect_in_predicate.h:
##########
@@ -0,0 +1,97 @@
+// 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.
+
+#pragma once
+
+#include "common/status.h"
+#include "vec/exprs/vexpr.h"
+
+namespace doris::vectorized {
+class VDirectInPredicate final : public VExpr {
+public:
+    VDirectInPredicate(const TExprNode& node)
+            : VExpr(node), _filter(nullptr), _expr_name("direct_in_predicate") 
{}
+    ~VDirectInPredicate() override = default;
+
+    Status execute(VExprContext* context, doris::vectorized::Block* block,
+                   int* result_column_id) override {
+        doris::vectorized::ColumnNumbers arguments(_children.size());
+        for (int i = 0; i < _children.size(); ++i) {
+            int column_id = -1;
+            RETURN_IF_ERROR(_children[i]->execute(context, block, &column_id));
+            arguments[i] = column_id;
+        }
+
+        size_t num_columns_without_result = block->columns();
+        auto res_data_column = ColumnVector<UInt8>::create(block->rows());
+        ColumnPtr argument_column =
+                
block->get_by_position(arguments[0]).column->convert_to_full_column_if_const();
+        size_t sz = argument_column->size();
+        res_data_column->resize(sz);
+
+        auto ptr = 
((ColumnVector<UInt8>*)res_data_column.get())->get_data().data();
+        auto type = 
WhichDataType(remove_nullable(block->get_by_position(arguments[0]).type));
+        if (type.is_string_or_fixed_string()) {
+            for (size_t i = 0; i < sz; i++) {
+                auto ele = argument_column->get_data_at(i);
+                StringValue v(ele.data, ele.size);
+                ptr[i] = _filter->find(reinterpret_cast<const void*>(&v));
+            }
+        } else if (type.is_int_or_uint() || type.is_float()) {
+            if (argument_column->is_nullable()) {
+                auto column_nested = reinterpret_cast<const 
ColumnNullable*>(argument_column.get())
+                                             ->get_nested_column_ptr();
+                auto column_nullmap = reinterpret_cast<const 
ColumnNullable*>(argument_column.get())
+                                              ->get_null_map_column_ptr();
+                _filter->find_fixed_len(column_nested->get_raw_data().data,
+                                        
(uint8*)column_nullmap->get_raw_data().data, sz, ptr);
+            } else {
+                _filter->find_fixed_len(argument_column->get_raw_data().data, 
nullptr, sz, ptr);
+            }
+        } else {
+            for (size_t i = 0; i < sz; i++) {
+                ptr[i] = _filter->find(
+                        reinterpret_cast<const 
void*>(argument_column->get_data_at(i).data));
+            }
+        }
+
+        if (_data_type->is_nullable()) {

Review Comment:
   this function only use by rf ? maybe do not need nullable column of result



-- 
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-unsubscr...@doris.apache.org

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


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

Reply via email to