Akshat-Jain commented on code in PR #17038: URL: https://github.com/apache/druid/pull/17038#discussion_r1794954147
########## processing/src/main/java/org/apache/druid/query/operator/AbstractPartitioningOperator.java: ########## @@ -0,0 +1,121 @@ +/* + * 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.druid.query.operator; + +import org.apache.druid.error.DruidException; +import org.apache.druid.java.util.common.RE; +import org.apache.druid.query.rowsandcols.RowsAndColumns; + +import java.io.Closeable; +import java.io.IOException; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; + +public abstract class AbstractPartitioningOperator implements Operator +{ + protected final List<String> partitionColumns; + protected final Operator child; + + public AbstractPartitioningOperator( + List<String> partitionColumns, + Operator child + ) + { + this.partitionColumns = partitionColumns; + this.child = child; + } + + protected static class Continuation implements Closeable + { + Iterator<RowsAndColumns> iter; + Closeable subContinuation; + + public Continuation(Iterator<RowsAndColumns> iter, Closeable subContinuation) + { + this.iter = iter; + this.subContinuation = subContinuation; + } + + @Override + public void close() throws IOException + { + if (subContinuation != null) { + subContinuation.close(); + } + } + } + + protected Signal handlePush(RowsAndColumns rac, Receiver receiver, AtomicReference<Iterator<RowsAndColumns>> iterHolder) + { + if (rac == null) { + throw DruidException.defensive("Should never get a null rac here."); + } + + Iterator<RowsAndColumns> partitionsIter = getIteratorForRAC(rac); + + AtomicReference<Signal> keepItGoing = new AtomicReference<>(Signal.GO); Review Comment: This isn't relevant anymore as I had to move this logic into Glueing/NaivePartitioningOperator layer (away from Abstract layer). I tried to keep `handlePush()` and `handleKeepItGoing()` in Abstract layer, but since we are using static classes now, we can't override the implementation of a static method, so I had to remove these methods and move the logic to the individual classes. -- 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]
