gianm commented on code in PR #12848: URL: https://github.com/apache/druid/pull/12848#discussion_r937249800
########## processing/src/main/java/org/apache/druid/frame/processor/FrameProcessorExecutor.java: ########## @@ -0,0 +1,602 @@ +/* + * 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.frame.processor; + +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Preconditions; +import com.google.common.collect.Multimaps; +import com.google.common.collect.SetMultimap; +import com.google.common.collect.Sets; +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.SettableFuture; +import com.google.errorprone.annotations.concurrent.GuardedBy; +import it.unimi.dsi.fastutil.ints.IntOpenHashSet; +import it.unimi.dsi.fastutil.ints.IntSet; +import org.apache.druid.frame.channel.ReadableFrameChannel; +import org.apache.druid.frame.channel.WritableFrameChannel; +import org.apache.druid.java.util.common.Either; +import org.apache.druid.java.util.common.StringUtils; +import org.apache.druid.java.util.common.concurrent.Execs; +import org.apache.druid.java.util.common.guava.Sequence; +import org.apache.druid.java.util.common.io.Closer; +import org.apache.druid.java.util.common.logger.Logger; + +import javax.annotation.Nullable; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.ExecutorService; +import java.util.function.BiFunction; +import java.util.stream.Collectors; + +/** + * Manages execution of {@link FrameProcessor} in an {@link ExecutorService}. Review Comment: > So, to run the "fragment" you just described, we'd have something like this? > > reader processor --> channel --> main logic processor --> channel --> output processor > > In this case, there are three concurrent frame processors communicating over in-memory channels? If so, it is very Go-like! Yeah, that's exactly how I'd imagined it. > How does the runner coordinate? What is the protocol that each frame processor uses to say "I can run" or "I could run, if you gave me more input" or "Sorry, EOF, I'm fresh out of data? This is what the ReturnOrAwait is for: - "I can run" is `ReturnOrAwait.runAgain()` - "I could run, if you gave me more input" is `ReturnOrAwait.awaitAny({set})` - "EOF" is `ReturnOrAwait.returnObject({return value})` > And, in the main logic, what structure, if any, do we provide if that logic is, say, a filter, projection and frame-repackaging? How do the various steps coordinate? I think that's TBD. In the near future (next patch in this sequence) I'm imagining that we actually don't have operators yet. Instead, each processor corresponds to a piece of a native query, and they're each written bespoke. One of the goals of the operator project would be to introduce the structure you are asking about. -- 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]
