jacktengg commented on code in PR #58582:
URL: https://github.com/apache/doris/pull/58582#discussion_r2604939114


##########
be/src/olap/predicate_creator.cpp:
##########
@@ -0,0 +1,125 @@
+// 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 "olap/predicate_creator.h"
+
+namespace doris {
+
+std::shared_ptr<ColumnPredicate> create_bloom_filter_predicate(
+        const uint32_t cid, const vectorized::DataTypePtr& data_type,
+        const std::shared_ptr<BloomFilterFuncBase>& filter) {
+    // Do the necessary type conversion, for CAST(STRING AS CHAR), we do 
nothing here but change the data type to the target type CHAR
+    std::shared_ptr<BloomFilterFuncBase> filter_olap;
+    filter_olap.reset(create_bloom_filter(data_type->get_primitive_type(), 
false));
+    filter_olap->light_copy(filter.get());
+    switch (data_type->get_primitive_type()) {
+    case TYPE_TINYINT: {
+        return BloomFilterColumnPredicate<TYPE_TINYINT>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_SMALLINT: {
+        return BloomFilterColumnPredicate<TYPE_SMALLINT>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_INT: {
+        return BloomFilterColumnPredicate<TYPE_INT>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_BIGINT: {
+        return BloomFilterColumnPredicate<TYPE_BIGINT>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_LARGEINT: {
+        return BloomFilterColumnPredicate<TYPE_LARGEINT>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_FLOAT: {
+        return BloomFilterColumnPredicate<TYPE_FLOAT>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_DOUBLE: {
+        return BloomFilterColumnPredicate<TYPE_DOUBLE>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_DECIMALV2: {
+        return BloomFilterColumnPredicate<TYPE_DECIMALV2>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_DECIMAL32: {
+        return BloomFilterColumnPredicate<TYPE_DECIMAL32>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_DECIMAL64: {
+        return BloomFilterColumnPredicate<TYPE_DECIMAL64>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_DECIMAL128I: {
+        return 
BloomFilterColumnPredicate<TYPE_DECIMAL128I>::create_shared(cid, filter_olap);
+    }
+    case TYPE_DECIMAL256: {
+        return BloomFilterColumnPredicate<TYPE_DECIMAL256>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_CHAR: {
+        return BloomFilterColumnPredicate<TYPE_CHAR>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_VARCHAR: {
+        return BloomFilterColumnPredicate<TYPE_VARCHAR>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_STRING: {
+        return BloomFilterColumnPredicate<TYPE_STRING>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_DATE: {
+        return BloomFilterColumnPredicate<TYPE_DATE>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_DATEV2: {
+        return BloomFilterColumnPredicate<TYPE_DATEV2>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_DATETIME: {
+        return BloomFilterColumnPredicate<TYPE_DATETIME>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_DATETIMEV2: {
+        return BloomFilterColumnPredicate<TYPE_DATETIMEV2>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_BOOLEAN: {
+        return BloomFilterColumnPredicate<TYPE_BOOLEAN>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_IPV4: {
+        return BloomFilterColumnPredicate<TYPE_IPV4>::create_shared(cid, 
filter_olap);
+    }
+    case TYPE_IPV6: {
+        return BloomFilterColumnPredicate<TYPE_IPV6>::create_shared(cid, 
filter_olap);
+    }
+    default:
+        return nullptr;

Review Comment:
   Should also throw Exception here?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to