uglymagic commented on a change in pull request #11830:
URL: https://github.com/apache/flink/pull/11830#discussion_r531363295



##########
File path: 
flink-table/flink-table-runtime-blink/src/test/java/org/apache/flink/table/runtime/operators/aggregate/GroupAggFunctionTestBase.java
##########
@@ -0,0 +1,188 @@
+/*
+ * 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.flink.table.runtime.operators.aggregate;
+
+import org.apache.flink.api.common.time.Time;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.table.dataformat.BaseRow;
+import org.apache.flink.table.dataformat.GenericRow;
+import org.apache.flink.table.dataformat.JoinedRow;
+import org.apache.flink.table.runtime.dataview.StateDataViewStore;
+import org.apache.flink.table.runtime.generated.AggsHandleFunction;
+import org.apache.flink.table.runtime.generated.GeneratedAggsHandleFunction;
+import org.apache.flink.table.runtime.generated.GeneratedRecordEqualiser;
+import org.apache.flink.table.runtime.generated.RecordEqualiser;
+import org.apache.flink.table.runtime.typeutils.BaseRowTypeInfo;
+import org.apache.flink.table.runtime.util.BaseRowHarnessAssertor;
+import org.apache.flink.table.runtime.util.BaseRowRecordEqualiser;
+import org.apache.flink.table.runtime.util.BinaryRowKeySelector;
+import org.apache.flink.table.runtime.util.GenericRowRecordSortComparator;
+import org.apache.flink.table.types.logical.BigIntType;
+import org.apache.flink.table.types.logical.IntType;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.VarCharType;
+
+/**
+ * Base class of tests for all kinds of GroupAgg.
+ */
+abstract class GroupAggFunctionTestBase {
+
+       Time minTime = Time.milliseconds(10);
+
+       LogicalType[] inputFieldTypes = new LogicalType[] {
+                       new VarCharType(VarCharType.MAX_LENGTH),
+                       new IntType(),
+                       new BigIntType() };
+
+       BaseRowTypeInfo outputType = new BaseRowTypeInfo(
+                       new VarCharType(VarCharType.MAX_LENGTH),
+                       new BigIntType(),
+                       new BigIntType());
+
+       LogicalType[] accTypes = new LogicalType[] { new BigIntType(), new 
BigIntType() };
+       BinaryRowKeySelector keySelector = new BinaryRowKeySelector(new 
int[]{0}, inputFieldTypes);
+       TypeInformation<BaseRow> keyType = keySelector.getProducedType();
+       GeneratedRecordEqualiser equaliser = new GeneratedRecordEqualiser("", 
"", new Object[0]) {
+
+               private static final long serialVersionUID = 
1532460173848746788L;
+
+               @Override
+               public RecordEqualiser newInstance(ClassLoader classLoader) {
+                       return new BaseRowRecordEqualiser();
+               }
+       };
+
+       GeneratedAggsHandleFunction function =
+                       new GeneratedAggsHandleFunction("Function", "", new 
Object[0]) {
+               @Override
+               public AggsHandleFunction newInstance(ClassLoader classLoader) {
+                       return new SumAndCountAgg();
+               }
+       };
+
+       BaseRowHarnessAssertor assertor = new BaseRowHarnessAssertor(
+               outputType.getFieldTypes(),
+               new GenericRowRecordSortComparator(0, new 
VarCharType(VarCharType.MAX_LENGTH)));
+
+       static final class SumAndCountAgg implements AggsHandleFunction {
+               long sum;
+               boolean sumIsNull;
+               long count;
+               boolean countIsNull;

Review comment:
       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.

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


Reply via email to