You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "hqx871 (via GitHub)" <gi...@apache.org> on 2023/02/16 16:42:00 UTC
[GitHub] [druid] hqx871 opened a new pull request, #13303: Hadoop based batch ingestion support range partition
hqx871 opened a new pull request, #13303:
URL: https://github.com/apache/druid/pull/13303
<!-- Thanks for trying to help us make Apache Druid be the best it can be! Please fill out as much of the following information as is possible (where relevant, and remove it when irrelevant) to help make the intention and scope of this PR clear in order to ease review. -->
<!-- Please read the doc for contribution (https://github.com/apache/druid/blob/master/CONTRIBUTING.md) before making this PR. Also, once you open a PR, please _avoid using force pushes and rebasing_ since these make it difficult for reviewers to see what you've changed in response to their reviews. See [the 'If your pull request shows conflicts with master' section](https://github.com/apache/druid/blob/master/CONTRIBUTING.md#if-your-pull-request-shows-conflicts-with-master) for more details. -->
<!-- Replace XXXX with the id of the issue fixed in this PR. Remove this section if there is no corresponding issue. Don't reference the issue in the title of this pull-request. -->
<!-- If you are a committer, follow the PR action item checklist for committers:
https://github.com/apache/druid/blob/master/dev/committer-instructions.md#pr-and-issue-action-item-checklist-for-committers. -->
### Description
<!-- Describe the goal of this PR, what problem are you fixing. If there is a corresponding issue (referenced above), it's not necessary to repeat the description here, however, you may choose to keep one summary sentence. -->
<!-- Describe your patch: what did you change in code? How did you fix the problem? -->
<!-- If there are several relatively logically separate changes in this PR, create a mini-section for each of them. For example: -->
This pr implements range partitioning for hadoop-based ingestion. For detail about multi dimension range partition can be seen https://github.com/apache/druid/pull/11848.
This pr also add a sample parameter to fast DeterminePartitionsJob.
<!--
In each section, please describe design decisions made, including:
- Choice of algorithms
- Behavioral aspects. What configuration values are acceptable? How are corner cases and error conditions handled, such as when there are insufficient resources?
- Class organization and design (how the logic is split between classes, inheritance, composition, design patterns)
- Method organization and design (how the logic is split between methods, parameters and return types)
- Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
-->
<!-- It's good to describe an alternative design (or mention an alternative name) for every design (or naming) decision point and compare the alternatives with the designs that you've implemented (or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
<!-- If there was a discussion of the design of the feature implemented in this PR elsewhere (e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list), link to that discussion from this PR description and explain what have changed in your final design compared to your original proposal or the consensus version in the end of the discussion. If something hasn't changed since the original discussion, you can omit a detailed discussion of those aspects of the design here, perhaps apart from brief mentioning for the sake of readability of this PR description. -->
<!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
<hr>
##### Key changed/added classes in this PR
* `DeterminePartitionsJob`
* `HadoopTuningConfig`
<hr>
<!-- 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 below are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
hqx871 commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-1379972552
> > I have not add a integration test before, where can I find an example and learn from it?
>
> You can just update `ITHadoopIndexTest` to include a `DimensionRangePartitionSpec` in the `resources()` method.
Thanks @kfaraz, I have add the integration test and also add comment for the sample parameter
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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
Re: [PR] Hadoop based batch ingestion support range partition (druid)
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-2371445087
> @hqx871 Has the doc been added for this? In particularly https://druid.apache.org/docs/latest/ingestion/hadoop/#partitionsspec seems to still only mentioned hash and single_dim.
Sorry, my English is poor. So I left this job to the druid team
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1098744608
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -603,6 +647,28 @@ protected void innerReduce(Context context, SortableBytes keyBytes, Iterable<Dim
}
}
+ static DimensionRangeShardSpec createShardSpec(
+ boolean isSingleDim,
Review Comment:
In some cases DimensionRangePartitionsSpec can set with only one partitionDimension. I just keep the DimensionRangePartitionsSpec what the user sets.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] kfaraz commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1098129525
##########
core/src/main/java/org/apache/druid/indexer/partitions/DimensionRangePartitionsSpec.java:
##########
@@ -144,6 +146,17 @@ public List<String> getPartitionDimensions()
return partitionDimensions;
}
+ public DimensionRangeShardSpec createShardSpec(
Review Comment:
> This is just to be compatible with what single_dim like before my pr. I do not make any modification here.
Makes sense, we can make this fix in a later PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1066591162
##########
core/src/main/java/org/apache/druid/indexer/partitions/SingleDimensionPartitionsSpec.java:
##########
@@ -146,6 +154,44 @@ public String getForceGuaranteedRollupIncompatiblityReason()
return FORCE_GUARANTEED_ROLLUP_COMPATIBLE;
}
+ @Override
+ public List<List<String>> getDimensionGroupingSet(DimensionsSpec dimensionsSpec)
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096461066
##########
core/src/main/java/org/apache/druid/indexer/partitions/DimensionRangePartitionsSpec.java:
##########
@@ -144,6 +146,17 @@ public List<String> getPartitionDimensions()
return partitionDimensions;
}
+ public DimensionRangeShardSpec createShardSpec(
Review Comment:
> Secretly choosing a partition dimension behind the scenes is probably not so great
This is just to be compatible with what single_dim like before. I do not make any new modification here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096465016
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -346,10 +361,14 @@ protected void innerMap(
rollupGranularity.bucketStart(inputRow.getTimestamp()).getMillis(),
inputRow
);
- context.write(
- new BytesWritable(HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey)),
- NullWritable.get()
- );
+
+ final byte[] bytes = HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey);
+ if (sample <= 1 || Math.abs(HASH_FUNCTION.hashBytes(bytes).asInt()) % sample == 0) {
+ context.write(
Review Comment:
You mean like this?
```
final byte[] bytes = HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey);
bool emitRow = sample <= 1 || Math.abs(HASH_FUNCTION.hashBytes(bytes).asInt()) % sample == 0;
if (emitRow) {
context.write(
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096492578
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -476,22 +502,29 @@ void emitDimValueCounts(
final byte[] groupKey = buf.array();
// Emit row-counter value.
- write(context, groupKey, new DimValueCount("", "", 1));
-
- for (final Map.Entry<String, Iterable<String>> dimAndValues : dims.entrySet()) {
- final String dim = dimAndValues.getKey();
-
- if (partitionDimension == null || partitionDimension.equals(dim)) {
- final Iterable<String> dimValues = dimAndValues.getValue();
-
- if (Iterables.size(dimValues) == 1) {
- // Emit this value.
- write(context, groupKey, new DimValueCount(dim, Iterables.getOnlyElement(dimValues), 1));
+ write(context, groupKey, new DimValueCount(Collections.emptyList(), StringTuple.create(), 1));
+
+ Iterator<List<String>> dimensionGroupIterator = dimensionGroupingSet.iterator();
Review Comment:
> Ah, I see it now. Thanks for the clarification.
>
> In the case of single_dim too, I was wondering if we even need this check anymore. I don't think we can submit a spec with null partition dimension even for single_dim, atleast for index_parallel. There is a check in `ParallelIndexTuningConfig` which validates that partition dimensions are always specified.
>
> We should have a similar check in `HadoopTuningConfig` too. Secretly choosing a partition dimension behind the scenes is probably not so great. It's better to fail if no partition dimension has been specified. What do you think?
This just to be compatible with the old logical. As you can see from the deleted 484 line code, when the partitionDimension is null, the old code will emit every dimValues.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1066536274
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -476,22 +502,29 @@ void emitDimValueCounts(
final byte[] groupKey = buf.array();
// Emit row-counter value.
- write(context, groupKey, new DimValueCount("", "", 1));
-
- for (final Map.Entry<String, Iterable<String>> dimAndValues : dims.entrySet()) {
- final String dim = dimAndValues.getKey();
-
- if (partitionDimension == null || partitionDimension.equals(dim)) {
- final Iterable<String> dimValues = dimAndValues.getValue();
-
- if (Iterables.size(dimValues) == 1) {
- // Emit this value.
- write(context, groupKey, new DimValueCount(dim, Iterables.getOnlyElement(dimValues), 1));
+ write(context, groupKey, new DimValueCount(Collections.emptyList(), StringTuple.create(), 1));
+
+ Iterator<List<String>> dimensionGroupIterator = dimensionGroupingSet.iterator();
Review Comment:
For single_dim this is not always a singleton as it will try every dimension
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] abhishekagarwal87 commented on pull request #13303: Hadoop based batch ingestion support range partition
Posted by "abhishekagarwal87 (via GitHub)" <gi...@apache.org>.
abhishekagarwal87 commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-1439743997
@hqx871 - can you resolve the conflicts?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] abhishekagarwal87 commented on pull request #13303: Hadoop based batch ingestion support range partition
Posted by "abhishekagarwal87 (via GitHub)" <gi...@apache.org>.
abhishekagarwal87 commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-1441255046
@hqx871 - thank you. I am going to merge this PR. but can you also do a follow-up PR to add docs for this new feature?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] github-code-scanning[bot] commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "github-code-scanning[bot] (via GitHub)" <gi...@apache.org>.
github-code-scanning[bot] commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096479128
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -412,8 +420,8 @@
{
super.setup(context);
final HadoopDruidIndexerConfig config = HadoopDruidIndexerConfig.fromConfiguration(context.getConfiguration());
- final SingleDimensionPartitionsSpec spec = (SingleDimensionPartitionsSpec) config.getPartitionsSpec();
- helper = new DeterminePartitionsDimSelectionMapperHelper(config, spec.getPartitionDimension());
+ helper = new DeterminePartitionsDimSelectionMapperHelper(config);
+ final HadoopTuningConfig tuningConfig = getConfig().getSchema().getTuningConfig();
Review Comment:
## Unread local variable
Variable 'HadoopTuningConfig tuningConfig' is never read.
[Show more details](https://github.com/apache/druid/security/code-scanning/4229)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] kfaraz commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1098130049
##########
core/src/test/java/org/apache/druid/timeline/partition/DimensionRangeShardSpecTest.java:
##########
@@ -136,6 +136,61 @@ public void testShardSpecLookup()
);
}
+ @Test
+ public void testShardSpecLookupWithNull()
+ {
+ setDimensions("dim1", "dim2");
+
+ final DimensionRangeShardSpec shard0 = new DimensionRangeShardSpec(
+ dimensions,
+ null,
+ StringTuple.create("India", null),
+ 1,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard1 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("India", null),
+ StringTuple.create("Spain", "Valencia"),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard2 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Spain", "Valencia"),
+ StringTuple.create("Tokyo", null),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard3 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Tokyo", null),
+ null,
+ 100,
+ 1
+ );
+ final ShardSpecLookup lookup = shard0.getLookup(Arrays.asList(shard0, shard1, shard2, shard3));
Review Comment:
Is this call still valid?
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -603,6 +647,28 @@ protected void innerReduce(Context context, SortableBytes keyBytes, Iterable<Dim
}
}
+ static DimensionRangeShardSpec createShardSpec(
+ boolean isSingleDim,
Review Comment:
The number of `dimensions` should be enough to determine whether it is single dim or not. I don't think we need this argument, `isSingleDim`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] github-code-scanning[bot] commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
github-code-scanning[bot] commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1066567947
##########
indexing-hadoop/src/test/java/org/apache/druid/indexer/DetermineRangePartitionsJobTest.java:
##########
@@ -0,0 +1,448 @@
+/*
+ * 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.indexer;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.apache.druid.data.input.impl.CSVParseSpec;
+import org.apache.druid.data.input.impl.DimensionsSpec;
+import org.apache.druid.data.input.impl.StringInputRowParser;
+import org.apache.druid.data.input.impl.TimestampSpec;
+import org.apache.druid.indexer.partitions.DimensionRangePartitionsSpec;
+import org.apache.druid.java.util.common.FileUtils;
+import org.apache.druid.java.util.common.Intervals;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.query.aggregation.AggregatorFactory;
+import org.apache.druid.query.aggregation.LongSumAggregatorFactory;
+import org.apache.druid.segment.indexing.DataSchema;
+import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec;
+import org.apache.druid.timeline.partition.DimensionRangeShardSpec;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+
+@RunWith(Parameterized.class)
+public class DetermineRangePartitionsJobTest
+{
+ private HadoopDruidIndexerConfig config;
+ private int expectedNumOfSegments;
+ private int[] expectedNumOfShardsForEachSegment;
+ private String[][][][] expectedStartEndForEachShard;
+ private File dataFile;
+ private File tmpDir;
+
+ @Parameterized.Parameters(name = "assumeGrouped={0}, "
+ + "targetPartitionSize={1}, "
+ + "interval={2}"
+ + "expectedNumOfSegments={3}, "
+ + "expectedNumOfShardsForEachSegment={4}, "
+ + "expectedStartEndForEachShard={5}, "
+ + "data={6}, "
+ + "partitionDimensions={7}")
+ public static Collection<Object[]> constructFeed()
+ {
+ return Arrays.asList(
+ new Object[][]{
+ {
+ false,
+ 3,
+ "2014-10-20T00:00:00Z/P1D",
+ 1,
+ new int[]{4},
+ new String[][][][]{
+ {
+ {null, {"d.example.com"}},
+ {{"d.example.com"}, {"g.example.com"}},
+ {{"g.example.com"}, {"j.example.com"}},
+ {{"j.example.com"}, null},
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,c.example.com,US,200",
+ "2014102000,c.example.com,US,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,US,963",
+ "2014102000,i.example.com,US,963",
+ "2014102000,j.example.com,US,333",
+ "2014102000,j.example.com,US,333"
+ ),
+ ImmutableList.of("host")
+ },
+ {
+ true,
+ 3,
+ "2014-10-22T00:00:00Z/P1D",
+ 1,
+ new int[]{4},
+ new String[][][][]{
+ {
+ {null, {"d.example.com", "US"}},
+ {{"d.example.com", "US"}, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, {"j.example.com", "US"}},
+ {{"j.example.com", "US"}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102200,a.example.com,CN,100",
+ "2014102200,b.exmaple.com,US,50",
+ "2014102200,c.example.com,US,200",
+ "2014102200,d.example.com,US,250",
+ "2014102200,e.example.com,US,123",
+ "2014102200,f.example.com,US,567",
+ "2014102200,g.example.com,US,11",
+ "2014102200,h.example.com,US,251",
+ "2014102200,i.example.com,US,963",
+ "2014102200,j.example.com,US,333"
+ ),
+ ImmutableList.of("host", "country")
+ },
+ {
+ false,
+ 3,
+ "2014-10-20T00:00:00Z/P1D",
+ 1,
+ new int[]{4},
+ new String[][][][]{
+ {
+ {null, {"d.example.com", "US"}},
+ {{"d.example.com", "US"}, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, {"j.example.com", "US"}},
+ {{"j.example.com", "US"}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,c.example.com,US,200",
+ "2014102000,c.example.com,US,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,US,963",
+ "2014102000,i.example.com,US,963",
+ "2014102000,j.example.com,US,333",
+ "2014102000,j.example.com,US,333"
+ ),
+ ImmutableList.of("host", "country")
+ },
+ {
+ true,
+ 6,
+ "2014-10-20T00:00:00Z/P3D",
+ 3,
+ new int[]{2, 2, 2},
+ new String[][][][]{
+ {
+ {null, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, null}
+ },
+ {
+ {null, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, null}
+ },
+ {
+ {null, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,CN,50",
+ "2014102000,c.example.com,CN,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,US,963",
+ "2014102000,j.example.com,US,333",
+ "2014102000,k.example.com,US,555",
+ "2014102100,a.example.com,CN,100",
+ "2014102100,b.exmaple.com,CN,50",
+ "2014102100,c.example.com,CN,200",
+ "2014102100,d.example.com,US,250",
+ "2014102100,e.example.com,US,123",
+ "2014102100,f.example.com,US,567",
+ "2014102100,g.example.com,US,11",
+ "2014102100,h.example.com,US,251",
+ "2014102100,i.example.com,US,963",
+ "2014102100,j.example.com,US,333",
+ "2014102100,k.example.com,US,555",
+ "2014102200,a.example.com,CN,100",
+ "2014102200,b.exmaple.com,CN,50",
+ "2014102200,c.example.com,CN,200",
+ "2014102200,d.example.com,US,250",
+ "2014102200,e.example.com,US,123",
+ "2014102200,f.example.com,US,567",
+ "2014102200,g.example.com,US,11",
+ "2014102200,h.example.com,US,251",
+ "2014102200,i.example.com,US,963",
+ "2014102200,j.example.com,US,333",
+ "2014102200,k.example.com,US,555"
+ ),
+ ImmutableList.of("host", "country")
+ },
+ {
+ false,
+ 2,
+ "2014-10-20T00:00:00Z/P1D",
+ 1,
+ new int[]{5},
+ new String[][][][]{
+ {
+ {null, {"c.example.com", null}},
+ {{"c.example.com", null}, {"e.example.com", "US"}},
+ {{"e.example.com", "US"}, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, {"i.example.com", null}},
+ {{"i.example.com", null}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,c.example.com,,200",
+ "2014102000,c.example.com,,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,,963",
+ "2014102000,i.example.com,,963",
+ "2014102000,j.example.com,US,333",
+ "2014102000,j.example.com,US,333"
+ ),
+ ImmutableList.of("host", "country")
+ },
+ {
+ true,
+ 2,
+ "2014-10-20T00:00:00Z/P1D",
+ 1,
+ new int[]{5},
+ new String[][][][]{
+ {
+ {null, {"c.example.com", null}},
+ {{"c.example.com", null}, {"e.example.com", "US"}},
+ {{"e.example.com", "US"}, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, {"i.example.com", null}},
+ {{"i.example.com", null}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,c.example.com,,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,,963",
+ "2014102000,j.example.com,US,333"
+ ),
+ ImmutableList.of("host", "country")
+ }
+ }
+ );
+ }
+
+ public DetermineRangePartitionsJobTest(
+ boolean assumeGrouped,
+ Integer targetPartitionSize,
+ String interval,
+ int expectedNumOfSegments,
+ int[] expectedNumOfShardsForEachSegment,
+ String[][][][] expectedStartEndForEachShard,
+ List<String> data,
+ List<String> partitionDimensions
+ ) throws IOException
+ {
+ this.expectedNumOfSegments = expectedNumOfSegments;
+ this.expectedNumOfShardsForEachSegment = expectedNumOfShardsForEachSegment;
+ this.expectedStartEndForEachShard = expectedStartEndForEachShard;
+
+ dataFile = File.createTempFile("test_website_data", "tmp");
+ dataFile.deleteOnExit();
+ tmpDir = FileUtils.createTempDir();
+ tmpDir.deleteOnExit();
+
+ org.apache.commons.io.FileUtils.writeLines(dataFile, data);
+
+ config = new HadoopDruidIndexerConfig(
+ new HadoopIngestionSpec(
+ new DataSchema(
+ "website",
+ HadoopDruidIndexerConfig.JSON_MAPPER.convertValue(
+ new StringInputRowParser(
+ new CSVParseSpec(
+ new TimestampSpec("timestamp", "yyyyMMddHH", null),
+ new DimensionsSpec(
+ DimensionsSpec.getDefaultSchemas(ImmutableList.of("host", "country"))
+ ),
+ null,
+ ImmutableList.of("timestamp", "host", "country", "visited_num"),
+ false,
+ 0
+ ),
+ null
+ ),
+ Map.class
+ ),
+ new AggregatorFactory[]{new LongSumAggregatorFactory("visited_num", "visited_num")},
+ new UniformGranularitySpec(
+ Granularities.DAY,
+ Granularities.NONE,
+ ImmutableList.of(Intervals.of(interval))
+ ),
+ null,
+ HadoopDruidIndexerConfig.JSON_MAPPER
+ ),
Review Comment:
## Deprecated method or constructor invocation
Invoking [DataSchema.DataSchema](1) should be avoided because it has been deprecated.
[Show more details](https://github.com/apache/druid/security/code-scanning/3646)
##########
indexing-hadoop/src/test/java/org/apache/druid/indexer/DetermineRangePartitionsJobTest.java:
##########
@@ -0,0 +1,448 @@
+/*
+ * 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.indexer;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.apache.druid.data.input.impl.CSVParseSpec;
+import org.apache.druid.data.input.impl.DimensionsSpec;
+import org.apache.druid.data.input.impl.StringInputRowParser;
+import org.apache.druid.data.input.impl.TimestampSpec;
+import org.apache.druid.indexer.partitions.DimensionRangePartitionsSpec;
+import org.apache.druid.java.util.common.FileUtils;
+import org.apache.druid.java.util.common.Intervals;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.query.aggregation.AggregatorFactory;
+import org.apache.druid.query.aggregation.LongSumAggregatorFactory;
+import org.apache.druid.segment.indexing.DataSchema;
+import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec;
+import org.apache.druid.timeline.partition.DimensionRangeShardSpec;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+
+@RunWith(Parameterized.class)
+public class DetermineRangePartitionsJobTest
+{
+ private HadoopDruidIndexerConfig config;
+ private int expectedNumOfSegments;
+ private int[] expectedNumOfShardsForEachSegment;
+ private String[][][][] expectedStartEndForEachShard;
+ private File dataFile;
+ private File tmpDir;
+
+ @Parameterized.Parameters(name = "assumeGrouped={0}, "
+ + "targetPartitionSize={1}, "
+ + "interval={2}"
+ + "expectedNumOfSegments={3}, "
+ + "expectedNumOfShardsForEachSegment={4}, "
+ + "expectedStartEndForEachShard={5}, "
+ + "data={6}, "
+ + "partitionDimensions={7}")
+ public static Collection<Object[]> constructFeed()
+ {
+ return Arrays.asList(
+ new Object[][]{
+ {
+ false,
+ 3,
+ "2014-10-20T00:00:00Z/P1D",
+ 1,
+ new int[]{4},
+ new String[][][][]{
+ {
+ {null, {"d.example.com"}},
+ {{"d.example.com"}, {"g.example.com"}},
+ {{"g.example.com"}, {"j.example.com"}},
+ {{"j.example.com"}, null},
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,c.example.com,US,200",
+ "2014102000,c.example.com,US,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,US,963",
+ "2014102000,i.example.com,US,963",
+ "2014102000,j.example.com,US,333",
+ "2014102000,j.example.com,US,333"
+ ),
+ ImmutableList.of("host")
+ },
+ {
+ true,
+ 3,
+ "2014-10-22T00:00:00Z/P1D",
+ 1,
+ new int[]{4},
+ new String[][][][]{
+ {
+ {null, {"d.example.com", "US"}},
+ {{"d.example.com", "US"}, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, {"j.example.com", "US"}},
+ {{"j.example.com", "US"}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102200,a.example.com,CN,100",
+ "2014102200,b.exmaple.com,US,50",
+ "2014102200,c.example.com,US,200",
+ "2014102200,d.example.com,US,250",
+ "2014102200,e.example.com,US,123",
+ "2014102200,f.example.com,US,567",
+ "2014102200,g.example.com,US,11",
+ "2014102200,h.example.com,US,251",
+ "2014102200,i.example.com,US,963",
+ "2014102200,j.example.com,US,333"
+ ),
+ ImmutableList.of("host", "country")
+ },
+ {
+ false,
+ 3,
+ "2014-10-20T00:00:00Z/P1D",
+ 1,
+ new int[]{4},
+ new String[][][][]{
+ {
+ {null, {"d.example.com", "US"}},
+ {{"d.example.com", "US"}, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, {"j.example.com", "US"}},
+ {{"j.example.com", "US"}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,c.example.com,US,200",
+ "2014102000,c.example.com,US,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,US,963",
+ "2014102000,i.example.com,US,963",
+ "2014102000,j.example.com,US,333",
+ "2014102000,j.example.com,US,333"
+ ),
+ ImmutableList.of("host", "country")
+ },
+ {
+ true,
+ 6,
+ "2014-10-20T00:00:00Z/P3D",
+ 3,
+ new int[]{2, 2, 2},
+ new String[][][][]{
+ {
+ {null, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, null}
+ },
+ {
+ {null, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, null}
+ },
+ {
+ {null, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,CN,50",
+ "2014102000,c.example.com,CN,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,US,963",
+ "2014102000,j.example.com,US,333",
+ "2014102000,k.example.com,US,555",
+ "2014102100,a.example.com,CN,100",
+ "2014102100,b.exmaple.com,CN,50",
+ "2014102100,c.example.com,CN,200",
+ "2014102100,d.example.com,US,250",
+ "2014102100,e.example.com,US,123",
+ "2014102100,f.example.com,US,567",
+ "2014102100,g.example.com,US,11",
+ "2014102100,h.example.com,US,251",
+ "2014102100,i.example.com,US,963",
+ "2014102100,j.example.com,US,333",
+ "2014102100,k.example.com,US,555",
+ "2014102200,a.example.com,CN,100",
+ "2014102200,b.exmaple.com,CN,50",
+ "2014102200,c.example.com,CN,200",
+ "2014102200,d.example.com,US,250",
+ "2014102200,e.example.com,US,123",
+ "2014102200,f.example.com,US,567",
+ "2014102200,g.example.com,US,11",
+ "2014102200,h.example.com,US,251",
+ "2014102200,i.example.com,US,963",
+ "2014102200,j.example.com,US,333",
+ "2014102200,k.example.com,US,555"
+ ),
+ ImmutableList.of("host", "country")
+ },
+ {
+ false,
+ 2,
+ "2014-10-20T00:00:00Z/P1D",
+ 1,
+ new int[]{5},
+ new String[][][][]{
+ {
+ {null, {"c.example.com", null}},
+ {{"c.example.com", null}, {"e.example.com", "US"}},
+ {{"e.example.com", "US"}, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, {"i.example.com", null}},
+ {{"i.example.com", null}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,c.example.com,,200",
+ "2014102000,c.example.com,,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,,963",
+ "2014102000,i.example.com,,963",
+ "2014102000,j.example.com,US,333",
+ "2014102000,j.example.com,US,333"
+ ),
+ ImmutableList.of("host", "country")
+ },
+ {
+ true,
+ 2,
+ "2014-10-20T00:00:00Z/P1D",
+ 1,
+ new int[]{5},
+ new String[][][][]{
+ {
+ {null, {"c.example.com", null}},
+ {{"c.example.com", null}, {"e.example.com", "US"}},
+ {{"e.example.com", "US"}, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, {"i.example.com", null}},
+ {{"i.example.com", null}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,c.example.com,,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,,963",
+ "2014102000,j.example.com,US,333"
+ ),
+ ImmutableList.of("host", "country")
+ }
+ }
+ );
+ }
+
+ public DetermineRangePartitionsJobTest(
+ boolean assumeGrouped,
+ Integer targetPartitionSize,
+ String interval,
+ int expectedNumOfSegments,
+ int[] expectedNumOfShardsForEachSegment,
+ String[][][][] expectedStartEndForEachShard,
+ List<String> data,
+ List<String> partitionDimensions
+ ) throws IOException
+ {
+ this.expectedNumOfSegments = expectedNumOfSegments;
+ this.expectedNumOfShardsForEachSegment = expectedNumOfShardsForEachSegment;
+ this.expectedStartEndForEachShard = expectedStartEndForEachShard;
+
+ dataFile = File.createTempFile("test_website_data", "tmp");
Review Comment:
## Local information disclosure in a temporary directory
Local information disclosure vulnerability due to use of file readable by other local users.
[Show more details](https://github.com/apache/druid/security/code-scanning/3647)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1066582918
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -626,33 +677,39 @@ protected void innerReduce(Context context, SortableBytes keyBytes, Iterable<Dim
final DimValueCount firstDvc = iterator.next();
final long totalRows = firstDvc.numRows;
- if (!"".equals(firstDvc.dim) || !"".equals(firstDvc.value)) {
+ if (!Collections.emptyList().equals(firstDvc.dims) || firstDvc.values.size() != 0) {
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1066521056
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -626,33 +677,39 @@ protected void innerReduce(Context context, SortableBytes keyBytes, Iterable<Dim
final DimValueCount firstDvc = iterator.next();
final long totalRows = firstDvc.numRows;
- if (!"".equals(firstDvc.dim) || !"".equals(firstDvc.value)) {
+ if (!Collections.emptyList().equals(firstDvc.dims) || firstDvc.values.size() != 0) {
Review Comment:
The firstDvc.values is StringTuple and does not has the isEmpty method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] kfaraz commented on pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
kfaraz commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-1378233909
> I have not add a integration test before, where can I find an example and learn from it?
You can just update `ITHadoopIndexTest` to include a `DimensionRangePartitionSpec` in the `resources()` method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] kfaraz commented on pull request #13303: Hadoop based batch ingestion support range partition
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-1420136472
> Which testing should I add comment? The integration test or unit test?
@hqx871 , I meant any testing that you would have done on a Druid cluster with your changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1098744608
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -603,6 +647,28 @@ protected void innerReduce(Context context, SortableBytes keyBytes, Iterable<Dim
}
}
+ static DimensionRangeShardSpec createShardSpec(
+ boolean isSingleDim,
Review Comment:
In some cases DimensionRangePartitionsSpec can be set with only one partitionDimension. I just keep the DimensionRangePartitionsSpec what the user sets.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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
Re: [PR] Hadoop based batch ingestion support range partition (druid)
Posted by "maytasm (via GitHub)" <gi...@apache.org>.
maytasm commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-2354148237
@hqx871
Has the doc been added for this? In particularly https://druid.apache.org/docs/latest/ingestion/hadoop/#partitionsspec seems to still only mentioned hash and single_dim.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1098755961
##########
core/src/test/java/org/apache/druid/timeline/partition/DimensionRangeShardSpecTest.java:
##########
@@ -136,6 +136,61 @@ public void testShardSpecLookup()
);
}
+ @Test
+ public void testShardSpecLookupWithNull()
+ {
+ setDimensions("dim1", "dim2");
+
+ final DimensionRangeShardSpec shard0 = new DimensionRangeShardSpec(
+ dimensions,
+ null,
+ StringTuple.create("India", null),
+ 1,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard1 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("India", null),
+ StringTuple.create("Spain", "Valencia"),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard2 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Spain", "Valencia"),
+ StringTuple.create("Tokyo", null),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard3 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Tokyo", null),
+ null,
+ 100,
+ 1
+ );
+ final ShardSpecLookup lookup = shard0.getLookup(Arrays.asList(shard0, shard1, shard2, shard3));
Review Comment:
I learned this from somewhere else, like HashBucketShardSpecTest.testShardSpecLookup
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-1441807839
> @hqx871 - thank you. I am going to merge this PR. but can you also do a follow-up PR to add docs for this new feature?
Sure, I'd like to.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-1441226357
> @hqx871 - can you resolve the conflicts?
Fixed conflicts
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096458943
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -346,10 +361,14 @@ protected void innerMap(
rollupGranularity.bucketStart(inputRow.getTimestamp()).getMillis(),
inputRow
);
- context.write(
- new BytesWritable(HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey)),
- NullWritable.get()
- );
+
+ final byte[] bytes = HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey);
+ if (sample <= 1 || Math.abs(HASH_FUNCTION.hashBytes(bytes).asInt()) % sample == 0) {
Review Comment:
Yes, we only need to emit certain group keys.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] kfaraz commented on pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
kfaraz commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-1308445895
Hi @hqx871 ! Thanks for putting up the PR. We have a little backlog of PRs to review right now for the upcoming releases of Druid 24.0.1 and 25. I will try to get to this soon.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096461066
##########
core/src/main/java/org/apache/druid/indexer/partitions/DimensionRangePartitionsSpec.java:
##########
@@ -144,6 +146,17 @@ public List<String> getPartitionDimensions()
return partitionDimensions;
}
+ public DimensionRangeShardSpec createShardSpec(
Review Comment:
> Secretly choosing a partition dimension behind the scenes is probably not so great
This is just to be compatible with what single_dim like before my pr. I do not make any new modification here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096463817
##########
core/src/main/java/org/apache/druid/indexer/partitions/DimensionRangePartitionsSpec.java:
##########
@@ -144,6 +146,17 @@ public List<String> getPartitionDimensions()
return partitionDimensions;
}
+ public DimensionRangeShardSpec createShardSpec(
Review Comment:
> It is better to have this logic in DeterminePartitionsJob since it is only used there. You can check the number of dimensions and create either a DimensionRangeShardSpec or a SingleDimensionShardSpec.
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] abhishekagarwal87 merged pull request #13303: Hadoop based batch ingestion support range partition
Posted by "abhishekagarwal87 (via GitHub)" <gi...@apache.org>.
abhishekagarwal87 merged PR #13303:
URL: https://github.com/apache/druid/pull/13303
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1066515503
##########
core/src/main/java/org/apache/druid/indexer/partitions/SingleDimensionPartitionsSpec.java:
##########
@@ -146,6 +154,44 @@ public String getForceGuaranteedRollupIncompatiblityReason()
return FORCE_GUARANTEED_ROLLUP_COMPATIBLE;
}
+ @Override
+ public List<List<String>> getDimensionGroupingSet(DimensionsSpec dimensionsSpec)
Review Comment:
Hi @kfaraz, this method does not always returns a singleton list, as the single_dim will try every dimension from dimensionsSpec.getDimensions() to find the best when the partitionDimension is not set.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1098755961
##########
core/src/test/java/org/apache/druid/timeline/partition/DimensionRangeShardSpecTest.java:
##########
@@ -136,6 +136,61 @@ public void testShardSpecLookup()
);
}
+ @Test
+ public void testShardSpecLookupWithNull()
+ {
+ setDimensions("dim1", "dim2");
+
+ final DimensionRangeShardSpec shard0 = new DimensionRangeShardSpec(
+ dimensions,
+ null,
+ StringTuple.create("India", null),
+ 1,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard1 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("India", null),
+ StringTuple.create("Spain", "Valencia"),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard2 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Spain", "Valencia"),
+ StringTuple.create("Tokyo", null),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard3 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Tokyo", null),
+ null,
+ 100,
+ 1
+ );
+ final ShardSpecLookup lookup = shard0.getLookup(Arrays.asList(shard0, shard1, shard2, shard3));
Review Comment:
I just followed the DimensionRangeShardSpecTest.testShardSpecLookup
##########
core/src/test/java/org/apache/druid/timeline/partition/DimensionRangeShardSpecTest.java:
##########
@@ -136,6 +136,61 @@ public void testShardSpecLookup()
);
}
+ @Test
+ public void testShardSpecLookupWithNull()
+ {
+ setDimensions("dim1", "dim2");
+
+ final DimensionRangeShardSpec shard0 = new DimensionRangeShardSpec(
+ dimensions,
+ null,
+ StringTuple.create("India", null),
+ 1,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard1 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("India", null),
+ StringTuple.create("Spain", "Valencia"),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard2 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Spain", "Valencia"),
+ StringTuple.create("Tokyo", null),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard3 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Tokyo", null),
+ null,
+ 100,
+ 1
+ );
+ final ShardSpecLookup lookup = shard0.getLookup(Arrays.asList(shard0, shard1, shard2, shard3));
Review Comment:
I just followed the DimensionRangeShardSpecTest.testShardSpecLookup here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1098755961
##########
core/src/test/java/org/apache/druid/timeline/partition/DimensionRangeShardSpecTest.java:
##########
@@ -136,6 +136,61 @@ public void testShardSpecLookup()
);
}
+ @Test
+ public void testShardSpecLookupWithNull()
+ {
+ setDimensions("dim1", "dim2");
+
+ final DimensionRangeShardSpec shard0 = new DimensionRangeShardSpec(
+ dimensions,
+ null,
+ StringTuple.create("India", null),
+ 1,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard1 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("India", null),
+ StringTuple.create("Spain", "Valencia"),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard2 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Spain", "Valencia"),
+ StringTuple.create("Tokyo", null),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard3 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Tokyo", null),
+ null,
+ 100,
+ 1
+ );
+ final ShardSpecLookup lookup = shard0.getLookup(Arrays.asList(shard0, shard1, shard2, shard3));
Review Comment:
I just followed the testShardSpecLookup example here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1098769556
##########
core/src/test/java/org/apache/druid/timeline/partition/DimensionRangeShardSpecTest.java:
##########
@@ -136,6 +136,61 @@ public void testShardSpecLookup()
);
}
+ @Test
+ public void testShardSpecLookupWithNull()
+ {
+ setDimensions("dim1", "dim2");
+
+ final DimensionRangeShardSpec shard0 = new DimensionRangeShardSpec(
+ dimensions,
+ null,
+ StringTuple.create("India", null),
+ 1,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard1 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("India", null),
+ StringTuple.create("Spain", "Valencia"),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard2 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Spain", "Valencia"),
+ StringTuple.create("Tokyo", null),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard3 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Tokyo", null),
+ null,
+ 100,
+ 1
+ );
+ final ShardSpecLookup lookup = shard0.getLookup(Arrays.asList(shard0, shard1, shard2, shard3));
Review Comment:
Any problem with this line?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1098769556
##########
core/src/test/java/org/apache/druid/timeline/partition/DimensionRangeShardSpecTest.java:
##########
@@ -136,6 +136,61 @@ public void testShardSpecLookup()
);
}
+ @Test
+ public void testShardSpecLookupWithNull()
+ {
+ setDimensions("dim1", "dim2");
+
+ final DimensionRangeShardSpec shard0 = new DimensionRangeShardSpec(
+ dimensions,
+ null,
+ StringTuple.create("India", null),
+ 1,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard1 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("India", null),
+ StringTuple.create("Spain", "Valencia"),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard2 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Spain", "Valencia"),
+ StringTuple.create("Tokyo", null),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard3 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Tokyo", null),
+ null,
+ 100,
+ 1
+ );
+ final ShardSpecLookup lookup = shard0.getLookup(Arrays.asList(shard0, shard1, shard2, shard3));
Review Comment:
Is there any problem with this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] kfaraz commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
kfaraz commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1065327862
##########
core/src/main/java/org/apache/druid/indexer/partitions/SingleDimensionPartitionsSpec.java:
##########
@@ -146,6 +154,44 @@ public String getForceGuaranteedRollupIncompatiblityReason()
return FORCE_GUARANTEED_ROLLUP_COMPATIBLE;
}
+ @Override
+ public List<List<String>> getDimensionGroupingSet(DimensionsSpec dimensionsSpec)
Review Comment:
This method always returns a singleton list, so I think it should just return a `List<String>` rather than a list of lists.
This whole logic should be kept in `DeterminePartitionsJob` itself. We can just have a logic like this:
```
List<String> partitionDimensions = partitionsSpec.getPartitionDimensions();
if (partitionDimensions.isEmpty()) {
// determine the partitions from the DimensionsSpec
}
```
##########
core/src/main/java/org/apache/druid/indexer/partitions/DimensionRangePartitionsSpec.java:
##########
@@ -144,6 +148,27 @@ public List<String> getPartitionDimensions()
return partitionDimensions;
}
+ public List<List<String>> getDimensionGroupingSet(DimensionsSpec dimensionsSpec)
Review Comment:
The logic in these new methods should be kept in `DeterminePartitionsJob` itself as they are only used for Hadoop ingestion.
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -626,33 +677,39 @@ protected void innerReduce(Context context, SortableBytes keyBytes, Iterable<Dim
final DimValueCount firstDvc = iterator.next();
final long totalRows = firstDvc.numRows;
- if (!"".equals(firstDvc.dim) || !"".equals(firstDvc.value)) {
+ if (!Collections.emptyList().equals(firstDvc.dims) || firstDvc.values.size() != 0) {
Review Comment:
```suggestion
if (!firstDvc.dims.isEmpty() || !firstDvc.values.isEmpty()) {
```
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -437,13 +458,18 @@ protected void innerMap(
static class DeterminePartitionsDimSelectionMapperHelper
{
private final HadoopDruidIndexerConfig config;
- private final String partitionDimension;
+ private final List<List<String>> dimensionGroupingSet;
private final Map<Long, Integer> intervalIndexes;
+ private final boolean supportNullValue;
- DeterminePartitionsDimSelectionMapperHelper(HadoopDruidIndexerConfig config, String partitionDimension)
+ DeterminePartitionsDimSelectionMapperHelper(HadoopDruidIndexerConfig config)
{
this.config = config;
- this.partitionDimension = partitionDimension;
+
+ DimensionRangePartitionsSpec spec = (DimensionRangePartitionsSpec) config.getPartitionsSpec();
+ final DimensionsSpec dimensionsSpec = config.getSchema().getDataSchema().getDimensionsSpec();
+ this.dimensionGroupingSet = new ArrayList<>(spec.getDimensionGroupingSet(dimensionsSpec));
+ this.supportNullValue = spec.supportNullValue();
Review Comment:
This can be determined by using the count of partition dimensions instead.
```suggestion
this.supportNullValue = partitionDimensions.size() > 1;
```
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -476,22 +502,29 @@ void emitDimValueCounts(
final byte[] groupKey = buf.array();
// Emit row-counter value.
- write(context, groupKey, new DimValueCount("", "", 1));
-
- for (final Map.Entry<String, Iterable<String>> dimAndValues : dims.entrySet()) {
- final String dim = dimAndValues.getKey();
-
- if (partitionDimension == null || partitionDimension.equals(dim)) {
- final Iterable<String> dimValues = dimAndValues.getValue();
-
- if (Iterables.size(dimValues) == 1) {
- // Emit this value.
- write(context, groupKey, new DimValueCount(dim, Iterables.getOnlyElement(dimValues), 1));
+ write(context, groupKey, new DimValueCount(Collections.emptyList(), StringTuple.create(), 1));
+
+ Iterator<List<String>> dimensionGroupIterator = dimensionGroupingSet.iterator();
Review Comment:
This should be simplified as the `dimensionGroupingSet` is always a singleton list.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] kfaraz commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1092765726
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -346,10 +361,14 @@ protected void innerMap(
rollupGranularity.bucketStart(inputRow.getTimestamp()).getMillis(),
inputRow
);
- context.write(
- new BytesWritable(HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey)),
- NullWritable.get()
- );
+
+ final byte[] bytes = HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey);
+ if (sample <= 1 || Math.abs(HASH_FUNCTION.hashBytes(bytes).asInt()) % sample == 0) {
Review Comment:
Why are we using a hash of the bytes here? Doesn't this mean that we will never emit certain group keys?
##########
core/src/main/java/org/apache/druid/indexer/partitions/DimensionRangePartitionsSpec.java:
##########
@@ -144,6 +146,17 @@ public List<String> getPartitionDimensions()
return partitionDimensions;
}
+ public DimensionRangeShardSpec createShardSpec(
Review Comment:
It is better to have this logic in `DeterminePartitionsJob` since it is only used there. You can check the number of dimensions and create either a `DimensionRangeShardSpec` or a `SingleDimensionShardSpec`.
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -346,10 +361,14 @@ protected void innerMap(
rollupGranularity.bucketStart(inputRow.getTimestamp()).getMillis(),
inputRow
);
- context.write(
- new BytesWritable(HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey)),
- NullWritable.get()
- );
+
+ final byte[] bytes = HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey);
+ if (sample <= 1 || Math.abs(HASH_FUNCTION.hashBytes(bytes).asInt()) % sample == 0) {
+ context.write(
Review Comment:
Nit: This can be put on a single-line now.
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -476,22 +502,29 @@ void emitDimValueCounts(
final byte[] groupKey = buf.array();
// Emit row-counter value.
- write(context, groupKey, new DimValueCount("", "", 1));
-
- for (final Map.Entry<String, Iterable<String>> dimAndValues : dims.entrySet()) {
- final String dim = dimAndValues.getKey();
-
- if (partitionDimension == null || partitionDimension.equals(dim)) {
- final Iterable<String> dimValues = dimAndValues.getValue();
-
- if (Iterables.size(dimValues) == 1) {
- // Emit this value.
- write(context, groupKey, new DimValueCount(dim, Iterables.getOnlyElement(dimValues), 1));
+ write(context, groupKey, new DimValueCount(Collections.emptyList(), StringTuple.create(), 1));
+
+ Iterator<List<String>> dimensionGroupIterator = dimensionGroupingSet.iterator();
Review Comment:
Ah, I see it now. Thanks for the clarification.
In the case of single_dim too, I was wondering if we even need this check anymore. I don't think we can submit a spec with null partition dimension even for single_dim, atleast for index_parallel. There is a check in `ParallelIndexTuningConfig` which validates that partition dimensions are always specified.
We should have a similar check in `HadoopTuningConfig` too. Secretly choosing a partition dimension behind the scenes is probably not so great. It's better to fail if no partition dimension has been specified. What do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] kfaraz closed pull request #13303: Hadoop based batch ingestion support range partition
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz closed pull request #13303: Hadoop based batch ingestion support range partition
URL: https://github.com/apache/druid/pull/13303
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
hqx871 commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-1378206134
> Done an initial review. @hqx871 , thanks for the changes. Could you please do the following?
>
> * add an integration test that verifies hadoop ingestion with range partitioning
> * add comments explaining the usage and benefits of the new `sample` parameter in the tuning config.
I have not add a integration test before, where can I find an example and learn from it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] kfaraz commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
kfaraz commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1066567057
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -626,33 +677,39 @@ protected void innerReduce(Context context, SortableBytes keyBytes, Iterable<Dim
final DimValueCount firstDvc = iterator.next();
final long totalRows = firstDvc.numRows;
- if (!"".equals(firstDvc.dim) || !"".equals(firstDvc.value)) {
+ if (!Collections.emptyList().equals(firstDvc.dims) || firstDvc.values.size() != 0) {
Review Comment:
Ah, okay. Please only change the `firstDvc.dims` part then.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] github-code-scanning[bot] commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
github-code-scanning[bot] commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1066630421
##########
indexing-hadoop/src/test/java/org/apache/druid/indexer/DetermineRangePartitionsJobTest.java:
##########
@@ -0,0 +1,450 @@
+/*
+ * 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.indexer;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.apache.druid.data.input.impl.CSVParseSpec;
+import org.apache.druid.data.input.impl.DimensionsSpec;
+import org.apache.druid.data.input.impl.StringInputRowParser;
+import org.apache.druid.data.input.impl.TimestampSpec;
+import org.apache.druid.indexer.partitions.DimensionRangePartitionsSpec;
+import org.apache.druid.java.util.common.FileUtils;
+import org.apache.druid.java.util.common.Intervals;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.query.aggregation.AggregatorFactory;
+import org.apache.druid.query.aggregation.LongSumAggregatorFactory;
+import org.apache.druid.segment.indexing.DataSchema;
+import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec;
+import org.apache.druid.timeline.partition.DimensionRangeShardSpec;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+
+@RunWith(Parameterized.class)
+public class DetermineRangePartitionsJobTest
+{
+ private HadoopDruidIndexerConfig config;
+ private int expectedNumOfSegments;
+ private int[] expectedNumOfShardsForEachSegment;
+ private String[][][][] expectedStartEndForEachShard;
+ private File dataFile;
+ private File tmpDir;
+
+ @Parameterized.Parameters(name = "assumeGrouped={0}, "
+ + "targetPartitionSize={1}, "
+ + "interval={2}"
+ + "expectedNumOfSegments={3}, "
+ + "expectedNumOfShardsForEachSegment={4}, "
+ + "expectedStartEndForEachShard={5}, "
+ + "data={6}, "
+ + "partitionDimensions={7}")
+ public static Collection<Object[]> constructFeed()
+ {
+ return Arrays.asList(
+ new Object[][]{
+ {
+ false,
+ 3,
+ "2014-10-20T00:00:00Z/P1D",
+ 1,
+ new int[]{4},
+ new String[][][][]{
+ {
+ {null, {"d.example.com"}},
+ {{"d.example.com"}, {"g.example.com"}},
+ {{"g.example.com"}, {"j.example.com"}},
+ {{"j.example.com"}, null},
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,c.example.com,US,200",
+ "2014102000,c.example.com,US,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,US,963",
+ "2014102000,i.example.com,US,963",
+ "2014102000,j.example.com,US,333",
+ "2014102000,j.example.com,US,333"
+ ),
+ ImmutableList.of("host")
+ },
+ {
+ true,
+ 3,
+ "2014-10-22T00:00:00Z/P1D",
+ 1,
+ new int[]{4},
+ new String[][][][]{
+ {
+ {null, {"d.example.com", "US"}},
+ {{"d.example.com", "US"}, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, {"j.example.com", "US"}},
+ {{"j.example.com", "US"}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102200,a.example.com,CN,100",
+ "2014102200,b.exmaple.com,US,50",
+ "2014102200,c.example.com,US,200",
+ "2014102200,d.example.com,US,250",
+ "2014102200,e.example.com,US,123",
+ "2014102200,f.example.com,US,567",
+ "2014102200,g.example.com,US,11",
+ "2014102200,h.example.com,US,251",
+ "2014102200,i.example.com,US,963",
+ "2014102200,j.example.com,US,333"
+ ),
+ ImmutableList.of("host", "country")
+ },
+ {
+ false,
+ 3,
+ "2014-10-20T00:00:00Z/P1D",
+ 1,
+ new int[]{4},
+ new String[][][][]{
+ {
+ {null, {"d.example.com", "US"}},
+ {{"d.example.com", "US"}, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, {"j.example.com", "US"}},
+ {{"j.example.com", "US"}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,c.example.com,US,200",
+ "2014102000,c.example.com,US,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,US,963",
+ "2014102000,i.example.com,US,963",
+ "2014102000,j.example.com,US,333",
+ "2014102000,j.example.com,US,333"
+ ),
+ ImmutableList.of("host", "country")
+ },
+ {
+ true,
+ 6,
+ "2014-10-20T00:00:00Z/P3D",
+ 3,
+ new int[]{2, 2, 2},
+ new String[][][][]{
+ {
+ {null, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, null}
+ },
+ {
+ {null, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, null}
+ },
+ {
+ {null, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,CN,50",
+ "2014102000,c.example.com,CN,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,US,963",
+ "2014102000,j.example.com,US,333",
+ "2014102000,k.example.com,US,555",
+ "2014102100,a.example.com,CN,100",
+ "2014102100,b.exmaple.com,CN,50",
+ "2014102100,c.example.com,CN,200",
+ "2014102100,d.example.com,US,250",
+ "2014102100,e.example.com,US,123",
+ "2014102100,f.example.com,US,567",
+ "2014102100,g.example.com,US,11",
+ "2014102100,h.example.com,US,251",
+ "2014102100,i.example.com,US,963",
+ "2014102100,j.example.com,US,333",
+ "2014102100,k.example.com,US,555",
+ "2014102200,a.example.com,CN,100",
+ "2014102200,b.exmaple.com,CN,50",
+ "2014102200,c.example.com,CN,200",
+ "2014102200,d.example.com,US,250",
+ "2014102200,e.example.com,US,123",
+ "2014102200,f.example.com,US,567",
+ "2014102200,g.example.com,US,11",
+ "2014102200,h.example.com,US,251",
+ "2014102200,i.example.com,US,963",
+ "2014102200,j.example.com,US,333",
+ "2014102200,k.example.com,US,555"
+ ),
+ ImmutableList.of("host", "country")
+ },
+ {
+ false,
+ 2,
+ "2014-10-20T00:00:00Z/P1D",
+ 1,
+ new int[]{5},
+ new String[][][][]{
+ {
+ {null, {"c.example.com", null}},
+ {{"c.example.com", null}, {"e.example.com", "US"}},
+ {{"e.example.com", "US"}, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, {"i.example.com", null}},
+ {{"i.example.com", null}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,c.example.com,,200",
+ "2014102000,c.example.com,,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,,963",
+ "2014102000,i.example.com,,963",
+ "2014102000,j.example.com,US,333",
+ "2014102000,j.example.com,US,333"
+ ),
+ ImmutableList.of("host", "country")
+ },
+ {
+ true,
+ 2,
+ "2014-10-20T00:00:00Z/P1D",
+ 1,
+ new int[]{5},
+ new String[][][][]{
+ {
+ {null, {"c.example.com", null}},
+ {{"c.example.com", null}, {"e.example.com", "US"}},
+ {{"e.example.com", "US"}, {"g.example.com", "US"}},
+ {{"g.example.com", "US"}, {"i.example.com", null}},
+ {{"i.example.com", null}, null}
+ }
+ },
+ ImmutableList.of(
+ "2014102000,a.example.com,CN,100",
+ "2014102000,b.exmaple.com,US,50",
+ "2014102000,c.example.com,,200",
+ "2014102000,d.example.com,US,250",
+ "2014102000,e.example.com,US,123",
+ "2014102000,f.example.com,US,567",
+ "2014102000,g.example.com,US,11",
+ "2014102000,h.example.com,US,251",
+ "2014102000,i.example.com,,963",
+ "2014102000,j.example.com,US,333"
+ ),
+ ImmutableList.of("host", "country")
+ }
+ }
+ );
+ }
+
+ public DetermineRangePartitionsJobTest(
+ boolean assumeGrouped,
+ Integer targetPartitionSize,
+ String interval,
+ int expectedNumOfSegments,
+ int[] expectedNumOfShardsForEachSegment,
+ String[][][][] expectedStartEndForEachShard,
+ List<String> data,
+ List<String> partitionDimensions
+ ) throws IOException
+ {
+ this.expectedNumOfSegments = expectedNumOfSegments;
+ this.expectedNumOfShardsForEachSegment = expectedNumOfShardsForEachSegment;
+ this.expectedStartEndForEachShard = expectedStartEndForEachShard;
+
+ dataFile = File.createTempFile("test_range_website_data", "tmp");
Review Comment:
## Local information disclosure in a temporary directory
Local information disclosure vulnerability due to use of file readable by other local users.
[Show more details](https://github.com/apache/druid/security/code-scanning/3649)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096461066
##########
core/src/main/java/org/apache/druid/indexer/partitions/DimensionRangePartitionsSpec.java:
##########
@@ -144,6 +146,17 @@ public List<String> getPartitionDimensions()
return partitionDimensions;
}
+ public DimensionRangeShardSpec createShardSpec(
Review Comment:
> Secretly choosing a partition dimension behind the scenes is probably not so great
This is just to be compatible with what single_dim like before my pr. I do not make any modification here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096461483
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -346,10 +361,14 @@ protected void innerMap(
rollupGranularity.bucketStart(inputRow.getTimestamp()).getMillis(),
inputRow
);
- context.write(
- new BytesWritable(HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey)),
- NullWritable.get()
- );
+
+ final byte[] bytes = HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey);
+ if (sample <= 1 || Math.abs(HASH_FUNCTION.hashBytes(bytes).asInt()) % sample == 0) {
Review Comment:
As we hash on the whole group key, this will not cause skew
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096492578
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -476,22 +502,29 @@ void emitDimValueCounts(
final byte[] groupKey = buf.array();
// Emit row-counter value.
- write(context, groupKey, new DimValueCount("", "", 1));
-
- for (final Map.Entry<String, Iterable<String>> dimAndValues : dims.entrySet()) {
- final String dim = dimAndValues.getKey();
-
- if (partitionDimension == null || partitionDimension.equals(dim)) {
- final Iterable<String> dimValues = dimAndValues.getValue();
-
- if (Iterables.size(dimValues) == 1) {
- // Emit this value.
- write(context, groupKey, new DimValueCount(dim, Iterables.getOnlyElement(dimValues), 1));
+ write(context, groupKey, new DimValueCount(Collections.emptyList(), StringTuple.create(), 1));
+
+ Iterator<List<String>> dimensionGroupIterator = dimensionGroupingSet.iterator();
Review Comment:
This just to be compatible with the old logical. As you can see from the deleted 484 line code, when the partitionDimension is null, the old code will emit every dimAndValues.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096465016
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -346,10 +361,14 @@ protected void innerMap(
rollupGranularity.bucketStart(inputRow.getTimestamp()).getMillis(),
inputRow
);
- context.write(
- new BytesWritable(HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey)),
- NullWritable.get()
- );
+
+ final byte[] bytes = HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey);
+ if (sample <= 1 || Math.abs(HASH_FUNCTION.hashBytes(bytes).asInt()) % sample == 0) {
+ context.write(
Review Comment:
You mean like this?
```
final byte[] bytes = HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey);
boolean emitRow = sample <= 1 || Math.abs(HASH_FUNCTION.hashBytes(bytes).asInt()) % sample == 0;
if (emitRow) {
context.write(
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 closed pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 closed pull request #13303: Hadoop based batch ingestion support range partition
URL: https://github.com/apache/druid/pull/13303
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1098755961
##########
core/src/test/java/org/apache/druid/timeline/partition/DimensionRangeShardSpecTest.java:
##########
@@ -136,6 +136,61 @@ public void testShardSpecLookup()
);
}
+ @Test
+ public void testShardSpecLookupWithNull()
+ {
+ setDimensions("dim1", "dim2");
+
+ final DimensionRangeShardSpec shard0 = new DimensionRangeShardSpec(
+ dimensions,
+ null,
+ StringTuple.create("India", null),
+ 1,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard1 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("India", null),
+ StringTuple.create("Spain", "Valencia"),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard2 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Spain", "Valencia"),
+ StringTuple.create("Tokyo", null),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard3 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Tokyo", null),
+ null,
+ 100,
+ 1
+ );
+ final ShardSpecLookup lookup = shard0.getLookup(Arrays.asList(shard0, shard1, shard2, shard3));
Review Comment:
I just followed the HashBucketShardSpecTest.testShardSpecLookup here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-1416646001
> @hqx871 , I have left a few more comments.
>
> Regarding the `sample` parameter:
>
> * A more appropriate name for it would be `samplingFactor` since higher the value, fewer the samples we take. A value of 1 denoting no sampling at all.
> * It would be better to pull the sampling logic out of `DeterminePartitionsJob` into a separate class and reuse it in the two places.
> * It would also be nice to get some numbers to gauge the benefit that sampling provides and perhaps have a way for users to estimate the right sampling factor. Considering this, I would suggest to remove all the sampling logic from this PR and create a separate one for that, so that we can get the current one merged faster.
>
> Also, could you please add a comment regarding the testing that you have done? I will try to run the hadoop ITs to ensure that things work as expected.
I have removed all the sampling logic from this PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on PR #13303:
URL: https://github.com/apache/druid/pull/13303#issuecomment-1416757168
> Also, could you please add a comment regarding the testing that you have done?
Which testing should I add comment? The integration test or unit test?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096465016
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -346,10 +361,14 @@ protected void innerMap(
rollupGranularity.bucketStart(inputRow.getTimestamp()).getMillis(),
inputRow
);
- context.write(
- new BytesWritable(HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey)),
- NullWritable.get()
- );
+
+ final byte[] bytes = HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey);
+ if (sample <= 1 || Math.abs(HASH_FUNCTION.hashBytes(bytes).asInt()) % sample == 0) {
+ context.write(
Review Comment:
You mean like this?
```
final byte[] bytes = HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey);
boolean emitRow = sample <= 1 || Math.abs(HASH_FUNCTION.hashBytes(bytes).asInt()) % sample == 0;
if (emitRow) {
context.write(
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "hqx871 (via GitHub)" <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1096461483
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -346,10 +361,14 @@ protected void innerMap(
rollupGranularity.bucketStart(inputRow.getTimestamp()).getMillis(),
inputRow
);
- context.write(
- new BytesWritable(HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey)),
- NullWritable.get()
- );
+
+ final byte[] bytes = HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsBytes(groupKey);
+ if (sample <= 1 || Math.abs(HASH_FUNCTION.hashBytes(bytes).asInt()) % sample == 0) {
Review Comment:
As we hash on the whole group key, this will not cause skew, assuming the hash function is good
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] kfaraz commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1099992653
##########
core/src/test/java/org/apache/druid/timeline/partition/DimensionRangeShardSpecTest.java:
##########
@@ -136,6 +136,61 @@ public void testShardSpecLookup()
);
}
+ @Test
+ public void testShardSpecLookupWithNull()
+ {
+ setDimensions("dim1", "dim2");
+
+ final DimensionRangeShardSpec shard0 = new DimensionRangeShardSpec(
+ dimensions,
+ null,
+ StringTuple.create("India", null),
+ 1,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard1 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("India", null),
+ StringTuple.create("Spain", "Valencia"),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard2 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Spain", "Valencia"),
+ StringTuple.create("Tokyo", null),
+ 10,
+ 1
+ );
+
+ final DimensionRangeShardSpec shard3 = new DimensionRangeShardSpec(
+ dimensions,
+ StringTuple.create("Tokyo", null),
+ null,
+ 100,
+ 1
+ );
+ final ShardSpecLookup lookup = shard0.getLookup(Arrays.asList(shard0, shard1, shard2, shard3));
Review Comment:
Ah, yes, you are right. I was under the impression that the `getLookup` method was not defined on `DimensionRangeShardSpec` but it is there in the super class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] kfaraz commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1099995172
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -603,6 +647,28 @@ protected void innerReduce(Context context, SortableBytes keyBytes, Iterable<Dim
}
}
+ static DimensionRangeShardSpec createShardSpec(
+ boolean isSingleDim,
Review Comment:
In batch ingestion, if a user chooses `range` partitioning and specifies only one dimension, that results in `SingleDimensionShardSpec`s. But we can make this change later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1066527041
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -437,13 +458,18 @@ protected void innerMap(
static class DeterminePartitionsDimSelectionMapperHelper
{
private final HadoopDruidIndexerConfig config;
- private final String partitionDimension;
+ private final List<List<String>> dimensionGroupingSet;
private final Map<Long, Integer> intervalIndexes;
+ private final boolean supportNullValue;
- DeterminePartitionsDimSelectionMapperHelper(HadoopDruidIndexerConfig config, String partitionDimension)
+ DeterminePartitionsDimSelectionMapperHelper(HadoopDruidIndexerConfig config)
{
this.config = config;
- this.partitionDimension = partitionDimension;
+
+ DimensionRangePartitionsSpec spec = (DimensionRangePartitionsSpec) config.getPartitionsSpec();
+ final DimensionsSpec dimensionsSpec = config.getSchema().getDataSchema().getDimensionsSpec();
+ this.dimensionGroupingSet = new ArrayList<>(spec.getDimensionGroupingSet(dimensionsSpec));
+ this.supportNullValue = spec.supportNullValue();
Review Comment:
Hi @kfaraz, the single_dim does not support null values before, but actually it can. Shall I remove this and just let the range and single_dim both support null values?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] hqx871 commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
hqx871 commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1066515503
##########
core/src/main/java/org/apache/druid/indexer/partitions/SingleDimensionPartitionsSpec.java:
##########
@@ -146,6 +154,44 @@ public String getForceGuaranteedRollupIncompatiblityReason()
return FORCE_GUARANTEED_ROLLUP_COMPATIBLE;
}
+ @Override
+ public List<List<String>> getDimensionGroupingSet(DimensionsSpec dimensionsSpec)
Review Comment:
Hi @kfaraz, this method does not always returns a singleton list, as the single_dim will try every dimension from dimensionsSpec.getDimensions() to find the best when the partitionDimension is not set.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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] kfaraz commented on a diff in pull request #13303: Hadoop based batch ingestion support range partition
Posted by GitBox <gi...@apache.org>.
kfaraz commented on code in PR #13303:
URL: https://github.com/apache/druid/pull/13303#discussion_r1066567786
##########
indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java:
##########
@@ -437,13 +458,18 @@ protected void innerMap(
static class DeterminePartitionsDimSelectionMapperHelper
{
private final HadoopDruidIndexerConfig config;
- private final String partitionDimension;
+ private final List<List<String>> dimensionGroupingSet;
private final Map<Long, Integer> intervalIndexes;
+ private final boolean supportNullValue;
- DeterminePartitionsDimSelectionMapperHelper(HadoopDruidIndexerConfig config, String partitionDimension)
+ DeterminePartitionsDimSelectionMapperHelper(HadoopDruidIndexerConfig config)
{
this.config = config;
- this.partitionDimension = partitionDimension;
+
+ DimensionRangePartitionsSpec spec = (DimensionRangePartitionsSpec) config.getPartitionsSpec();
+ final DimensionsSpec dimensionsSpec = config.getSchema().getDataSchema().getDimensionsSpec();
+ this.dimensionGroupingSet = new ArrayList<>(spec.getDimensionGroupingSet(dimensionsSpec));
+ this.supportNullValue = spec.supportNullValue();
Review Comment:
Yeah, that would be okay too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
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