924060929 commented on code in PR #14169:
URL: https://github.com/apache/doris/pull/14169#discussion_r1019808819


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/BitmapUnionInt.java:
##########
@@ -0,0 +1,79 @@
+// 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.trees.expressions.functions.agg;
+
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
+import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
+import 
org.apache.doris.nereids.trees.expressions.typecoercion.ImplicitCastInputTypes;
+import org.apache.doris.nereids.types.BigIntType;
+import org.apache.doris.nereids.types.BitmapType;
+import org.apache.doris.nereids.types.DataType;
+import org.apache.doris.nereids.types.IntegerType;
+import org.apache.doris.nereids.types.SmallIntType;
+import org.apache.doris.nereids.types.TinyIntType;
+import org.apache.doris.nereids.types.coercion.AbstractDataType;
+import org.apache.doris.nereids.types.coercion.TypeCollection;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+
+import java.util.List;
+
+/** BitmapUnionInt */
+public class BitmapUnionInt extends AggregateFunction
+        implements UnaryExpression, PropagateNullable, ImplicitCastInputTypes {
+    public BitmapUnionInt(Expression arg0) {
+        super("bitmap_union_int", arg0);
+    }
+
+    public BitmapUnionInt(AggregateParam aggregateParam, Expression arg0) {
+        super("bitmap_union_int", aggregateParam, arg0);
+    }
+
+    @Override
+    public BitmapUnionInt withChildren(List<Expression> children) {
+        Preconditions.checkArgument(children.size() == 1);
+        return new BitmapUnionInt(getAggregateParam(), children.get(0));
+    }
+
+    @Override
+    public List<AbstractDataType> expectedInputTypes() {
+        if (isGlobal() && inputTypesBeforeDissemble().isPresent()) {
+            return ImmutableList.of();
+        } else {
+            return ImmutableList.of(new TypeCollection(
+                    TinyIntType.INSTANCE, SmallIntType.INSTANCE, 
IntegerType.INSTANCE, BigIntType.INSTANCE));

Review Comment:
   It can, see `aggregate_function_bitmap.cpp`
   
   ```cpp
   template <bool nullable, template <bool, typename> class 
AggregateFunctionTemplate>
   static IAggregateFunction* createWithIntDataType(const DataTypes& 
argument_type) {
       auto type = argument_type[0].get();
       if (type->is_nullable()) {
           type = assert_cast<const 
DataTypeNullable*>(type)->get_nested_type().get();
       }
       WhichDataType which(type);
       if (which.idx == TypeIndex::Int8) {
           return new AggregateFunctionTemplate<nullable, 
ColumnVector<Int8>>(argument_type);
       }
       if (which.idx == TypeIndex::Int16) {
           return new AggregateFunctionTemplate<nullable, 
ColumnVector<Int16>>(argument_type);
       }
       if (which.idx == TypeIndex::Int32) {
           return new AggregateFunctionTemplate<nullable, 
ColumnVector<Int32>>(argument_type);
       }
       if (which.idx == TypeIndex::Int64) {
           return new AggregateFunctionTemplate<nullable, 
ColumnVector<Int64>>(argument_type);
       }
       return nullptr;
   }
   
   AggregateFunctionPtr create_aggregate_function_bitmap_union_int(const 
std::string& name,
                                                                   const 
DataTypes& argument_types,
                                                                   const Array& 
parameters,
                                                                   const bool 
result_is_nullable) {
       const bool arg_is_nullable = argument_types[0]->is_nullable();
       if (arg_is_nullable) {
           return std::shared_ptr<IAggregateFunction>(
                   createWithIntDataType<true, 
AggregateFunctionBitmapCount>(argument_types));
       } else {
           return std::shared_ptr<IAggregateFunction>(
                   createWithIntDataType<false, 
AggregateFunctionBitmapCount>(argument_types));
       }
   }
   ```



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