You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2020/09/11 22:27:50 UTC

[GitHub] [druid] a2l007 opened a new pull request #10387: Support combining inputsource for parallel ingestion

a2l007 opened a new pull request #10387:
URL: https://github.com/apache/druid/pull/10387


   ### Description
   This PR adds a new `InputSource` that can read from nested inputsources for parallel indexing. The tutorial ingestion spec has been modified to use this inputsource as well.
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
   - [x] added documentation for new or modified features or behaviors.
   - [x] added integration tests.
   - [x] been tested in a test Druid cluster.
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist above are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
   
   <hr>
   
   ##### Key changed/added classes in this PR
    * `CombiningInputSource`
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] a2l007 commented on a change in pull request #10387: Support combining inputsource for parallel ingestion

Posted by GitBox <gi...@apache.org>.
a2l007 commented on a change in pull request #10387:
URL: https://github.com/apache/druid/pull/10387#discussion_r487429439



##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       Yeah did think about that and it would be definitely be more useful if we can handle multiple inputFormats as well. For doing this, we might have to push `inputFormat` to be a part of the `inputSource` config. Since it would impact other inputSources as well, I thought it would be better to investigate that separately and have an independent PR for that.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case it would be useful.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case where it would be useful.

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       Yeah did think about that and it would be definitely be more useful if we can handle multiple inputFormats as well. For doing this, we might have to push `inputFormat` to be a part of the `inputSource` config. Since it would impact other inputSources as well, I thought it would be better to investigate that separately and have an independent PR for that.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case it would be useful.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case where it would be useful.

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       Yeah did think about that and it would be definitely be more useful if we can handle multiple inputFormats as well. For doing this, we might have to push `inputFormat` to be a part of the `inputSource` config. Since it would impact other inputSources as well, I thought it would be better to investigate that separately and have an independent PR for that.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case it would be useful.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case where it would be useful.

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       Yeah did think about that and it would be definitely be more useful if we can handle multiple inputFormats as well. For doing this, we might have to push `inputFormat` to be a part of the `inputSource` config. Since it would impact other inputSources as well, I thought it would be better to investigate that separately and have an independent PR for that.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case it would be useful.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case where it would be useful.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] a2l007 commented on a change in pull request #10387: Support combining inputsource for parallel ingestion

Posted by GitBox <gi...@apache.org>.
a2l007 commented on a change in pull request #10387:
URL: https://github.com/apache/druid/pull/10387#discussion_r487429439



##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       Yeah did think about that and it would be definitely be more useful if we can handle multiple inputFormats as well. For doing this, we might have to push `inputFormat` to be a part of the `inputSource` config. Since it would impact other inputSources as well, I thought it would be better to investigate that separately and have an independent PR for that.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case it would be useful.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case where it would be useful.

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       Yeah did think about that and it would be definitely be more useful if we can handle multiple inputFormats as well. For doing this, we might have to push `inputFormat` to be a part of the `inputSource` config. Since it would impact other inputSources as well, I thought it would be better to investigate that separately and have an independent PR for that.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case it would be useful.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case where it would be useful.

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       Yeah did think about that and it would be definitely be more useful if we can handle multiple inputFormats as well. For doing this, we might have to push `inputFormat` to be a part of the `inputSource` config. Since it would impact other inputSources as well, I thought it would be better to investigate that separately and have an independent PR for that.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case it would be useful.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case where it would be useful.

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       Yeah did think about that and it would be definitely be more useful if we can handle multiple inputFormats as well. For doing this, we might have to push `inputFormat` to be a part of the `inputSource` config. Since it would impact other inputSources as well, I thought it would be better to investigate that separately and have an independent PR for that.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case it would be useful.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case where it would be useful.

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       Yeah did think about that and it would be definitely be more useful if we can handle multiple inputFormats as well. For doing this, we might have to push `inputFormat` to be a part of the `inputSource` config. Since it would impact other inputSources as well, I thought it would be better to investigate that separately and have an independent PR for that.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case it would be useful.

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case where it would be useful.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] jihoonson commented on a change in pull request #10387: Support combining inputsource for parallel ingestion

Posted by GitBox <gi...@apache.org>.
jihoonson commented on a change in pull request #10387:
URL: https://github.com/apache/druid/pull/10387#discussion_r487606586



##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       Sounds good to me. When we add support for multiple inputFormats, we should probably think about how we can make batch and streaming ingestion spec less diverse in describing inputSource and inputFormat as streaming ingestion currently doesn't require inputSource.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] a2l007 commented on a change in pull request #10387: Support combining inputsource for parallel ingestion

Posted by GitBox <gi...@apache.org>.
a2l007 commented on a change in pull request #10387:
URL: https://github.com/apache/druid/pull/10387#discussion_r487429444



##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case it would be useful.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] jihoonson commented on a change in pull request #10387: Support combining inputsource for parallel ingestion

Posted by GitBox <gi...@apache.org>.
jihoonson commented on a change in pull request #10387:
URL: https://github.com/apache/druid/pull/10387#discussion_r487371767



##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit

Review comment:
       I think this is good to document in the class-level Javadoc. Would you please add a description for overall behavior?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Hmm, should it override `isSplittable()` and return true only when all underlying inputSources are splittable?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit
+        return inputSource.createSplits(inputFormat, splitHintSpec)
+                          .map(inputsplit -> new InputSplit(Pair.of(inputSource, inputsplit)));
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    });
+  }
+
+  @Override
+  public int estimateNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec)
+  {
+    return delegates.stream().mapToInt(inputSource -> {
+      try {
+        return inputSource.estimateNumSplits(inputFormat, splitHintSpec);
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    }).sum();
+  }
+
+  @Override
+  public InputSource withSplit(InputSplit split)
+  {
+    Pair<SplittableInputSource, InputSplit> inputSourceWithSplit = (Pair) split.get();
+    return inputSourceWithSplit.lhs.withSplit(inputSourceWithSplit.rhs);
+  }
+
+  @Override
+  public boolean needsFormat()
+  {
+    // This is called only when ParallelIndexIngestionSpec needs to decide if either inputformat vs parserspec is required.
+    // So if atleast one of the delegate inputSources needsFormat, we set this to true.

Review comment:
       typo: at least

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       > please note that delegate input sources requiring an `inputFormat` must have the same format for input data.
   
   Hmm, thinking about this requirement, could it be more useful if you can read multiple inputSources even when they are formatted differently? 

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit

Review comment:
       I think this is good to document in the class-level Javadoc. Would you please add a description for overall behavior?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Hmm, should it override `isSplittable()` and return true only when all underlying inputSources are splittable?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit
+        return inputSource.createSplits(inputFormat, splitHintSpec)
+                          .map(inputsplit -> new InputSplit(Pair.of(inputSource, inputsplit)));
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    });
+  }
+
+  @Override
+  public int estimateNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec)
+  {
+    return delegates.stream().mapToInt(inputSource -> {
+      try {
+        return inputSource.estimateNumSplits(inputFormat, splitHintSpec);
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    }).sum();
+  }
+
+  @Override
+  public InputSource withSplit(InputSplit split)
+  {
+    Pair<SplittableInputSource, InputSplit> inputSourceWithSplit = (Pair) split.get();
+    return inputSourceWithSplit.lhs.withSplit(inputSourceWithSplit.rhs);
+  }
+
+  @Override
+  public boolean needsFormat()
+  {
+    // This is called only when ParallelIndexIngestionSpec needs to decide if either inputformat vs parserspec is required.
+    // So if atleast one of the delegate inputSources needsFormat, we set this to true.

Review comment:
       typo: at least

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       > please note that delegate input sources requiring an `inputFormat` must have the same format for input data.
   
   Hmm, thinking about this requirement, could it be more useful if you can read multiple inputSources even when they are formatted differently? 

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit

Review comment:
       I think this is good to document in the class-level Javadoc. Would you please add a description for overall behavior?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Hmm, should it override `isSplittable()` and return true only when all underlying inputSources are splittable?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit
+        return inputSource.createSplits(inputFormat, splitHintSpec)
+                          .map(inputsplit -> new InputSplit(Pair.of(inputSource, inputsplit)));
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    });
+  }
+
+  @Override
+  public int estimateNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec)
+  {
+    return delegates.stream().mapToInt(inputSource -> {
+      try {
+        return inputSource.estimateNumSplits(inputFormat, splitHintSpec);
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    }).sum();
+  }
+
+  @Override
+  public InputSource withSplit(InputSplit split)
+  {
+    Pair<SplittableInputSource, InputSplit> inputSourceWithSplit = (Pair) split.get();
+    return inputSourceWithSplit.lhs.withSplit(inputSourceWithSplit.rhs);
+  }
+
+  @Override
+  public boolean needsFormat()
+  {
+    // This is called only when ParallelIndexIngestionSpec needs to decide if either inputformat vs parserspec is required.
+    // So if atleast one of the delegate inputSources needsFormat, we set this to true.

Review comment:
       typo: at least

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       > please note that delegate input sources requiring an `inputFormat` must have the same format for input data.
   
   Hmm, thinking about this requirement, could it be more useful if you can read multiple inputSources even when they are formatted differently? 

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit

Review comment:
       I think this is good to document in the class-level Javadoc. Would you please add a description for overall behavior?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Hmm, should it override `isSplittable()` and return true only when all underlying inputSources are splittable?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit
+        return inputSource.createSplits(inputFormat, splitHintSpec)
+                          .map(inputsplit -> new InputSplit(Pair.of(inputSource, inputsplit)));
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    });
+  }
+
+  @Override
+  public int estimateNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec)
+  {
+    return delegates.stream().mapToInt(inputSource -> {
+      try {
+        return inputSource.estimateNumSplits(inputFormat, splitHintSpec);
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    }).sum();
+  }
+
+  @Override
+  public InputSource withSplit(InputSplit split)
+  {
+    Pair<SplittableInputSource, InputSplit> inputSourceWithSplit = (Pair) split.get();
+    return inputSourceWithSplit.lhs.withSplit(inputSourceWithSplit.rhs);
+  }
+
+  @Override
+  public boolean needsFormat()
+  {
+    // This is called only when ParallelIndexIngestionSpec needs to decide if either inputformat vs parserspec is required.
+    // So if atleast one of the delegate inputSources needsFormat, we set this to true.

Review comment:
       typo: at least

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       > please note that delegate input sources requiring an `inputFormat` must have the same format for input data.
   
   Hmm, thinking about this requirement, could it be more useful if you can read multiple inputSources even when they are formatted differently? 

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit

Review comment:
       I think this is good to document in the class-level Javadoc. Would you please add a description for overall behavior?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Hmm, should it override `isSplittable()` and return true only when all underlying inputSources are splittable?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit
+        return inputSource.createSplits(inputFormat, splitHintSpec)
+                          .map(inputsplit -> new InputSplit(Pair.of(inputSource, inputsplit)));
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    });
+  }
+
+  @Override
+  public int estimateNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec)
+  {
+    return delegates.stream().mapToInt(inputSource -> {
+      try {
+        return inputSource.estimateNumSplits(inputFormat, splitHintSpec);
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    }).sum();
+  }
+
+  @Override
+  public InputSource withSplit(InputSplit split)
+  {
+    Pair<SplittableInputSource, InputSplit> inputSourceWithSplit = (Pair) split.get();
+    return inputSourceWithSplit.lhs.withSplit(inputSourceWithSplit.rhs);
+  }
+
+  @Override
+  public boolean needsFormat()
+  {
+    // This is called only when ParallelIndexIngestionSpec needs to decide if either inputformat vs parserspec is required.
+    // So if atleast one of the delegate inputSources needsFormat, we set this to true.

Review comment:
       typo: at least

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       > please note that delegate input sources requiring an `inputFormat` must have the same format for input data.
   
   Hmm, thinking about this requirement, could it be more useful if you can read multiple inputSources even when they are formatted differently? 

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit

Review comment:
       I think this is good to document in the class-level Javadoc. Would you please add a description for overall behavior?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Hmm, should it override `isSplittable()` and return true only when all underlying inputSources are splittable?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit
+        return inputSource.createSplits(inputFormat, splitHintSpec)
+                          .map(inputsplit -> new InputSplit(Pair.of(inputSource, inputsplit)));
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    });
+  }
+
+  @Override
+  public int estimateNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec)
+  {
+    return delegates.stream().mapToInt(inputSource -> {
+      try {
+        return inputSource.estimateNumSplits(inputFormat, splitHintSpec);
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    }).sum();
+  }
+
+  @Override
+  public InputSource withSplit(InputSplit split)
+  {
+    Pair<SplittableInputSource, InputSplit> inputSourceWithSplit = (Pair) split.get();
+    return inputSourceWithSplit.lhs.withSplit(inputSourceWithSplit.rhs);
+  }
+
+  @Override
+  public boolean needsFormat()
+  {
+    // This is called only when ParallelIndexIngestionSpec needs to decide if either inputformat vs parserspec is required.
+    // So if atleast one of the delegate inputSources needsFormat, we set this to true.

Review comment:
       typo: at least

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       > please note that delegate input sources requiring an `inputFormat` must have the same format for input data.
   
   Hmm, thinking about this requirement, could it be more useful if you can read multiple inputSources even when they are formatted differently? 

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit

Review comment:
       I think this is good to document in the class-level Javadoc. Would you please add a description for overall behavior?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Hmm, should it override `isSplittable()` and return true only when all underlying inputSources are splittable?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit
+        return inputSource.createSplits(inputFormat, splitHintSpec)
+                          .map(inputsplit -> new InputSplit(Pair.of(inputSource, inputsplit)));
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    });
+  }
+
+  @Override
+  public int estimateNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec)
+  {
+    return delegates.stream().mapToInt(inputSource -> {
+      try {
+        return inputSource.estimateNumSplits(inputFormat, splitHintSpec);
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    }).sum();
+  }
+
+  @Override
+  public InputSource withSplit(InputSplit split)
+  {
+    Pair<SplittableInputSource, InputSplit> inputSourceWithSplit = (Pair) split.get();
+    return inputSourceWithSplit.lhs.withSplit(inputSourceWithSplit.rhs);
+  }
+
+  @Override
+  public boolean needsFormat()
+  {
+    // This is called only when ParallelIndexIngestionSpec needs to decide if either inputformat vs parserspec is required.
+    // So if atleast one of the delegate inputSources needsFormat, we set this to true.

Review comment:
       typo: at least

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       > please note that delegate input sources requiring an `inputFormat` must have the same format for input data.
   
   Hmm, thinking about this requirement, could it be more useful if you can read multiple inputSources even when they are formatted differently? 

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit

Review comment:
       I think this is good to document in the class-level Javadoc. Would you please add a description for overall behavior?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Hmm, should it override `isSplittable()` and return true only when all underlying inputSources are splittable?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit
+        return inputSource.createSplits(inputFormat, splitHintSpec)
+                          .map(inputsplit -> new InputSplit(Pair.of(inputSource, inputsplit)));
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    });
+  }
+
+  @Override
+  public int estimateNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec)
+  {
+    return delegates.stream().mapToInt(inputSource -> {
+      try {
+        return inputSource.estimateNumSplits(inputFormat, splitHintSpec);
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    }).sum();
+  }
+
+  @Override
+  public InputSource withSplit(InputSplit split)
+  {
+    Pair<SplittableInputSource, InputSplit> inputSourceWithSplit = (Pair) split.get();
+    return inputSourceWithSplit.lhs.withSplit(inputSourceWithSplit.rhs);
+  }
+
+  @Override
+  public boolean needsFormat()
+  {
+    // This is called only when ParallelIndexIngestionSpec needs to decide if either inputformat vs parserspec is required.
+    // So if atleast one of the delegate inputSources needsFormat, we set this to true.

Review comment:
       typo: at least

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       > please note that delegate input sources requiring an `inputFormat` must have the same format for input data.
   
   Hmm, thinking about this requirement, could it be more useful if you can read multiple inputSources even when they are formatted differently? 

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit

Review comment:
       I think this is good to document in the class-level Javadoc. Would you please add a description for overall behavior?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Hmm, should it override `isSplittable()` and return true only when all underlying inputSources are splittable?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit
+        return inputSource.createSplits(inputFormat, splitHintSpec)
+                          .map(inputsplit -> new InputSplit(Pair.of(inputSource, inputsplit)));
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    });
+  }
+
+  @Override
+  public int estimateNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec)
+  {
+    return delegates.stream().mapToInt(inputSource -> {
+      try {
+        return inputSource.estimateNumSplits(inputFormat, splitHintSpec);
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    }).sum();
+  }
+
+  @Override
+  public InputSource withSplit(InputSplit split)
+  {
+    Pair<SplittableInputSource, InputSplit> inputSourceWithSplit = (Pair) split.get();
+    return inputSourceWithSplit.lhs.withSplit(inputSourceWithSplit.rhs);
+  }
+
+  @Override
+  public boolean needsFormat()
+  {
+    // This is called only when ParallelIndexIngestionSpec needs to decide if either inputformat vs parserspec is required.
+    // So if atleast one of the delegate inputSources needsFormat, we set this to true.

Review comment:
       typo: at least

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       > please note that delegate input sources requiring an `inputFormat` must have the same format for input data.
   
   Hmm, thinking about this requirement, could it be more useful if you can read multiple inputSources even when they are formatted differently? 




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] jihoonson commented on a change in pull request #10387: Support combining inputsource for parallel ingestion

Posted by GitBox <gi...@apache.org>.
jihoonson commented on a change in pull request #10387:
URL: https://github.com/apache/druid/pull/10387#discussion_r487371767



##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit

Review comment:
       I think this is good to document in the class-level Javadoc. Would you please add a description for overall behavior?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Hmm, should it override `isSplittable()` and return true only when all underlying inputSources are splittable?

##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.
+ */
+
+public class CombiningInputSource extends AbstractInputSource implements SplittableInputSource
+{
+  private final List<SplittableInputSource> delegates;
+
+  @JsonCreator
+  public CombiningInputSource(
+      @JsonProperty("delegates") List<SplittableInputSource> delegates
+  )
+  {
+    Preconditions.checkArgument(
+        delegates != null && !delegates.isEmpty(),
+        "Must specify atleast one delegate inputSource"
+    );
+    this.delegates = delegates;
+  }
+
+  @JsonProperty
+  public List<SplittableInputSource> getDelegates()
+  {
+    return delegates;
+  }
+
+  @Override
+  public Stream<InputSplit> createSplits(
+      InputFormat inputFormat,
+      @Nullable SplitHintSpec splitHintSpec
+  )
+  {
+    return delegates.stream().flatMap(inputSource -> {
+      try {
+        // Each inputSplit is paired up with its respective inputSource so that during split, withSplit() is called against
+        // the correct inputSource for each inputSplit
+        return inputSource.createSplits(inputFormat, splitHintSpec)
+                          .map(inputsplit -> new InputSplit(Pair.of(inputSource, inputsplit)));
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    });
+  }
+
+  @Override
+  public int estimateNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec)
+  {
+    return delegates.stream().mapToInt(inputSource -> {
+      try {
+        return inputSource.estimateNumSplits(inputFormat, splitHintSpec);
+      }
+      catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    }).sum();
+  }
+
+  @Override
+  public InputSource withSplit(InputSplit split)
+  {
+    Pair<SplittableInputSource, InputSplit> inputSourceWithSplit = (Pair) split.get();
+    return inputSourceWithSplit.lhs.withSplit(inputSourceWithSplit.rhs);
+  }
+
+  @Override
+  public boolean needsFormat()
+  {
+    // This is called only when ParallelIndexIngestionSpec needs to decide if either inputformat vs parserspec is required.
+    // So if atleast one of the delegate inputSources needsFormat, we set this to true.

Review comment:
       typo: at least

##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       > please note that delegate input sources requiring an `inputFormat` must have the same format for input data.
   
   Hmm, thinking about this requirement, could it be more useful if you can read multiple inputSources even when they are formatted differently? 




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] a2l007 commented on a change in pull request #10387: Support combining inputsource for parallel ingestion

Posted by GitBox <gi...@apache.org>.
a2l007 commented on a change in pull request #10387:
URL: https://github.com/apache/druid/pull/10387#discussion_r487429439



##########
File path: docs/ingestion/native-batch.md
##########
@@ -1368,6 +1368,48 @@ Compared to the other native batch InputSources, SQL InputSource behaves differe
 * Similar to file-based input formats, any updates to existing data will replace the data in segments specific to the intervals specified in the `granularitySpec`.
 
 
+### Combining Input Source
+
+The Combining input source is used to read data from multiple InputSources. This input source should be only used if all the delegate input sources are
+ _splittable_ and can be used by the [Parallel task](#parallel-task). This input source will identify the splits from its delegates and each split will be processed by a worker task. Similar to other input sources, this input source supports a single `inputFormat`. Therefore, please note that delegate input sources requiring an `inputFormat` must have the same format for input data.

Review comment:
       Yeah did think about that and it would be definitely be more useful if we can handle multiple inputFormats as well. For doing this, we might have to push `inputFormat` to be a part of the `inputSource` config. Since it would impact other inputSources as well, I thought it would be better to investigate that separately and have an independent PR for that.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] jihoonson commented on a change in pull request #10387: Support combining inputsource for parallel ingestion

Posted by GitBox <gi...@apache.org>.
jihoonson commented on a change in pull request #10387:
URL: https://github.com/apache/druid/pull/10387#discussion_r487606612



##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Ah, I missed that it only accepts `SplittableInputSource`s. It looks reasonable to me since we have only one non-splittable inputSource which is `InlineInputSource`.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] jihoonson merged pull request #10387: Support combining inputsource for parallel ingestion

Posted by GitBox <gi...@apache.org>.
jihoonson merged pull request #10387:
URL: https://github.com/apache/druid/pull/10387


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] a2l007 commented on a change in pull request #10387: Support combining inputsource for parallel ingestion

Posted by GitBox <gi...@apache.org>.
a2l007 commented on a change in pull request #10387:
URL: https://github.com/apache/druid/pull/10387#discussion_r487429444



##########
File path: core/src/main/java/org/apache/druid/data/input/impl/CombiningInputSource.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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.data.input.impl;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.druid.data.input.AbstractInputSource;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.SplitHintSpec;
+import org.apache.druid.java.util.common.Pair;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * InputSource that combines data from multiple inputSources. The delegate inputSources must be splittable.

Review comment:
       Since `CombiningInputSource` accepts a list of `SplittableInputSource` objects, the task would fail anyway at the deserialization phase if a non splittable input source was used. So I didn't think it would be needed to override isSplittable(). I can add it if you feel there is a case where it would be useful.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org