Copilot commented on code in PR #62841:
URL: https://github.com/apache/doris/pull/62841#discussion_r3159902891


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/BitmapCountToBitmapOpCount.java:
##########
@@ -0,0 +1,99 @@
+// 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.
+
+package org.apache.doris.nereids.rules.expression.rules;
+
+import org.apache.doris.nereids.rules.expression.ExpressionPatternMatcher;
+import org.apache.doris.nereids.rules.expression.ExpressionPatternRuleFactory;
+import org.apache.doris.nereids.rules.expression.ExpressionRuleType;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapAnd;
+import 
org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapAndCount;
+import 
org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapAndNot;
+import 
org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapAndNotAlias;
+import 
org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapAndNotCount;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapCount;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapNot;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapOr;
+import 
org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapOrCount;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapXor;
+import 
org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapXorCount;
+
+import com.google.common.collect.ImmutableList;
+
+import java.util.List;
+
+/**
+ * Rewrite bitmap_count(bitmap_xxx(...)) to bitmap_xxx_count(...).
+ */
+public class BitmapCountToBitmapOpCount implements 
ExpressionPatternRuleFactory {
+
+    public static final BitmapCountToBitmapOpCount INSTANCE = new 
BitmapCountToBitmapOpCount();
+

Review Comment:
   The PR title/description currently indicate a test-only change ("[test]" 
with empty problem summary), but this PR introduces planner rewrite rules and 
changes BE bitmap function semantics/implementations. Please update the PR 
title and description to accurately reflect the scope and user-visible behavior 
changes (especially nullability/null-handling for bitmap_*_count and 
BitmapValue SET representation).



##########
be/src/core/value/bitmap_value.h:
##########
@@ -1980,15 +2180,8 @@ class BitmapValue {
                 throw Exception(ErrorCode::INTERNAL_ERROR,
                                 "bitmap value with incorrect set count, count: 
{}", count);
             }
-            _set.reserve(count);
-            for (uint8_t i = 0; i != count; ++i, src += sizeof(uint64_t)) {
-                _set.insert(decode_fixed64_le(reinterpret_cast<const 
uint8_t*>(src)));
-            }
-            if (_set.size() != count) {
-                throw Exception(ErrorCode::INTERNAL_ERROR,
-                                "bitmap value with incorrect set count, count: 
{}, set size: {}",
-                                count, _set.size());
-            }
+            _set.read(src, count);
+            src += sizeof(uint64_t) * count;

Review Comment:
   `deserialize()` for SET payload no longer validates that the `count` values 
are unique. `BitmapSmallSet::read()` only DCHECKs uniqueness, so in release 
builds duplicated entries would be accepted and break set semantics (e.g., 
incorrect cardinality / wrong query results) instead of throwing as before. 
Please restore a runtime uniqueness check for SET deserialization (and fail 
fast with an error) or explicitly deduplicate/convert to BITMAP when duplicates 
are detected.



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