Jackie-Jiang commented on a change in pull request #4557: Support transform 
functions with AVG aggregation function
URL: https://github.com/apache/incubator-pinot/pull/4557#discussion_r317320082
 
 

 ##########
 File path: 
pinot-core/src/test/java/org/apache/pinot/queries/TransformQueriesTest.java
 ##########
 @@ -0,0 +1,286 @@
+/**
+ * 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.pinot.queries;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.TimeUnit;
+import org.apache.commons.io.FileUtils;
+import org.apache.pinot.common.data.DimensionFieldSpec;
+import org.apache.pinot.common.data.FieldSpec;
+import org.apache.pinot.common.data.MetricFieldSpec;
+import org.apache.pinot.common.data.Schema;
+import org.apache.pinot.common.data.TimeFieldSpec;
+import org.apache.pinot.common.data.TimeGranularitySpec;
+import org.apache.pinot.common.response.broker.AggregationResult;
+import org.apache.pinot.common.response.broker.BrokerResponseNative;
+import org.apache.pinot.common.segment.ReadMode;
+import org.apache.pinot.common.utils.time.TimeUtils;
+import org.apache.pinot.core.data.GenericRow;
+import org.apache.pinot.core.data.manager.SegmentDataManager;
+import org.apache.pinot.core.data.manager.offline.ImmutableSegmentDataManager;
+import org.apache.pinot.core.data.readers.GenericRowRecordReader;
+import org.apache.pinot.core.data.readers.RecordReader;
+import org.apache.pinot.core.indexsegment.IndexSegment;
+import org.apache.pinot.core.indexsegment.generator.SegmentGeneratorConfig;
+import org.apache.pinot.core.indexsegment.immutable.ImmutableSegment;
+import org.apache.pinot.core.indexsegment.immutable.ImmutableSegmentLoader;
+import org.apache.pinot.core.operator.blocks.IntermediateResultsBlock;
+import org.apache.pinot.core.operator.query.AggregationOperator;
+import org.apache.pinot.core.query.aggregation.function.customobject.AvgPair;
+import 
org.apache.pinot.core.segment.creator.impl.SegmentIndexCreationDriverImpl;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class TransformQueriesTest extends BaseQueriesTest {
+
+  private static final String D1 = "STRING_COL";
+  private static final String M1 = "INT_COL1";
+  private static final String M2 = "INT_COL2";
+  private static final String M3 = "LONG_COL1";
+  private static final String M4 = "LONG_COL2";
+  private static final String TIME = "T";
+  private static final String TABLE_NAME = "FOO";
+  private static final String SEGMENT_NAME_1 = "FOO_SEGMENT_1";
+  private static final String SEGMENT_NAME_2 = "FOO_SEGMENT_2";
+
+  private static final File INDEX_DIR = new File(FileUtils.getTempDirectory(), 
"TransformQueriesTest");
+
+  private Schema _schema;
+  private List<IndexSegment> _indexSegments = new ArrayList<>();
+  private List<SegmentDataManager> _segmentDataManagers;
+
+  @BeforeClass
+  public void setup() {
+    _schema = new Schema();
+
+    _schema.setSchemaName(TABLE_NAME);
+
+    final DimensionFieldSpec d1Spec = new DimensionFieldSpec(D1, 
FieldSpec.DataType.STRING, true);
+    _schema.addField(d1Spec);
+
+    final MetricFieldSpec m1Spec = new MetricFieldSpec(M1, 
FieldSpec.DataType.INT);
+    _schema.addField(m1Spec);
+
+    final MetricFieldSpec m2Spec = new MetricFieldSpec(M2, 
FieldSpec.DataType.INT);
+    _schema.addField(m2Spec);
+
+    final MetricFieldSpec m3Spec = new MetricFieldSpec(M3, 
FieldSpec.DataType.LONG);
+    _schema.addField(m3Spec);
+
+    final MetricFieldSpec m4Spec = new MetricFieldSpec(M4, 
FieldSpec.DataType.LONG);
+    _schema.addField(m4Spec);
+
+    final TimeFieldSpec tSpec = new TimeFieldSpec(new 
TimeGranularitySpec(FieldSpec.DataType.LONG, TimeUnit.MILLISECONDS, TIME));
+    _schema.addField(tSpec);
+  }
+
+  @AfterClass
+  public void destroy() {
 
 Review comment:
   (nit) We usually use tearDown()

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


With regards,
Apache Git Services

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

Reply via email to