a2l007 commented on a change in pull request #10030:
URL: https://github.com/apache/druid/pull/10030#discussion_r477402603



##########
File path: 
processing/src/main/java/org/apache/druid/query/MultiTableDataSource.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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;
+
+import org.apache.druid.timeline.Overshadowable;
+import org.apache.druid.timeline.TimelineLookup;
+import org.apache.druid.timeline.TimelineObjectHolder;
+import org.joda.time.Interval;
+
+import java.util.List;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+/**
+ * Represents a source of data for a query obtained from multiple base tables. 
Implementations of this interface
+ * must handle more than one table dataSource.

Review comment:
       makes sense. Thanks

##########
File path: processing/src/main/java/org/apache/druid/query/UnionDataSource.java
##########
@@ -26,12 +26,19 @@
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
 import org.apache.druid.java.util.common.IAE;
+import org.apache.druid.timeline.Overshadowable;
+import org.apache.druid.timeline.TimelineLookup;
+import org.apache.druid.timeline.TimelineObjectHolder;
+import org.joda.time.Interval;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
+import java.util.function.BiFunction;
 import java.util.stream.Collectors;
 
-public class UnionDataSource implements DataSource
+public class UnionDataSource implements MultiTableDataSource

Review comment:
       In that case, I would expect us to have a `MultiTableDataSource` 
implementation say `UnionTableDataSource` and the current `UnionDataSource` 
would go back to being a `DataSource` implementation that would start handling 
a list of `DataSource` objects. 
   Also, this would mean that we'd still have to keep the `UnionQueryRunner` to 
execute the nontable datasources and `UnionTableDataSource` separately and 
merge the results. Therefore for a union query with multiple tables and 
nontables, the tables would still be executed together under 
`UnionTableDataSource` and the non table datasources would be executed 
individually. There should be some refactoring within 
`ClientQuerySegmentWalker` in case we need to handle non tables that can be 
fulfilled with `LocalQuerySegmentWalker`.
   Do you see any issues with the `MultiTableDataSource` design in this PR?

##########
File path: 
server/src/main/java/org/apache/druid/server/coordination/ServerManager.java
##########
@@ -204,22 +224,45 @@ public ServerManager(
         analysis.getBaseQuery().orElse(query)
     );
 
-    final FunctionalIterable<QueryRunner<T>> queryRunners = FunctionalIterable
-        .create(specs)
-        .transformCat(
-            descriptor -> Collections.singletonList(
-                buildQueryRunnerForSegment(
+    final FunctionalIterable<QueryRunner<T>> queryRunners;
+    // This is to handle cases where multiple datasources may have the same 
SegmentDescriptor for an interval.

Review comment:
       yeah I was trying to avoid including datasources with segment 
descriptors as it would increase the size of the json payload transferred from 
the broker.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to