atris commented on a change in pull request #7141: URL: https://github.com/apache/incubator-pinot/pull/7141#discussion_r666685531
########## File path: pinot-core/src/main/java/org/apache/pinot/core/plan/DictionaryBasedDistinctPlanNode.java ########## @@ -0,0 +1,64 @@ +/** + * 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.core.plan; + +import org.apache.pinot.core.operator.query.DictionaryBasedDistinctOperator; +import org.apache.pinot.core.query.aggregation.function.AggregationFunction; +import org.apache.pinot.core.query.aggregation.function.DistinctAggregationFunction; +import org.apache.pinot.core.query.request.context.QueryContext; +import org.apache.pinot.segment.spi.IndexSegment; +import org.apache.pinot.segment.spi.index.reader.Dictionary; + +/** + * Execute a DISTINCT operation using dictionary based plan + */ +public class DictionaryBasedDistinctPlanNode implements PlanNode { + private final IndexSegment _indexSegment; + private final DistinctAggregationFunction _distinctAggregationFunction; + private final Dictionary _dictionary; + private final TransformPlanNode _transformPlanNode; + + /** + * Constructor for the class. + * + * @param indexSegment Segment to process + * @param queryContext Query context + */ + public DictionaryBasedDistinctPlanNode(IndexSegment indexSegment, QueryContext queryContext, Dictionary dictionary) { + _indexSegment = indexSegment; + AggregationFunction[] aggregationFunctions = queryContext.getAggregationFunctions(); + + assert aggregationFunctions != null && aggregationFunctions.length == 1 + && aggregationFunctions[0] instanceof DistinctAggregationFunction; + + _distinctAggregationFunction = (DistinctAggregationFunction) aggregationFunctions[0]; + + _dictionary = dictionary; + + _transformPlanNode = Review comment: We need the transform plan node to get the data type during result construction -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org