You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "davecromberge (via GitHub)" <gi...@apache.org> on 2025/01/21 19:05:52 UTC
[PR] Fix configuration handling during MergeRollupTask execution [pinot]
davecromberge opened a new pull request, #14856:
URL: https://github.com/apache/pinot/pull/14856
Aggregation function parameters and dimensions to erase were being extracted directly from the task configuration without prepending the merge level key.
For example, the task config is encoded by the Task generator as follows:
```
"hourly.keyA": "some value",
"hourly.keyB": "some other value",
"mergeLevel": "hourly"
```
Any lookups on the configuration during task execution have to include the mergeLevel prefix in order to resolve lookups correctly.
There were three options in trying to address this bugfix:
1. Change the encoding of the task config - TaskGenerator would need to strip out the merge level prefix and thus make it easier for key extraction. Problem is that this could break existing functionality.
2. Re-encode all keys without the prefix in the task config. This would bloat the config.
3. Include the merge level prefix in any key lookups - this approach is followed in this PR.
This PR should be tagged with `bugfix`
--
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@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Fix configuration handling during MergeRollupTask execution [pinot]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #14856:
URL: https://github.com/apache/pinot/pull/14856#issuecomment-2605596208
## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/14856?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 0.00%. Comparing base [(`59551e4`)](https://app.codecov.io/gh/apache/pinot/commit/59551e45224f1535c4863fd577622b37366ccc97?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`96a0f09`)](https://app.codecov.io/gh/apache/pinot/commit/96a0f0913a434541559b90ebf9604d0181c07758?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 1601 commits behind head on master.
> :exclamation: There is a different number of reports uploaded between BASE (59551e4) and HEAD (96a0f09). Click for more details.
>
> <details><summary>HEAD has 53 uploads less than BASE</summary>
>
>| Flag | BASE (59551e4) | HEAD (96a0f09) |
>|------|------|------|
>|integration|7|1|
>|integration2|3|1|
>|temurin|12|1|
>|java-21|7|1|
>|skip-bytebuffers-true|3|1|
>|skip-bytebuffers-false|7|0|
>|unittests|5|0|
>|unittests1|2|0|
>|java-11|5|0|
>|unittests2|3|0|
>|integration1|2|0|
>|custom-integration1|2|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #14856 +/- ##
=============================================
- Coverage 61.75% 0.00% -61.76%
=============================================
Files 2436 3 -2433
Lines 133233 6 -133227
Branches 20636 0 -20636
=============================================
- Hits 82274 0 -82274
+ Misses 44911 6 -44905
+ Partials 6048 0 -6048
```
| [Flag](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <ø> (-0.01%)` | :arrow_down: |
| [integration1](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration2](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <ø> (ø)` | |
| [java-11](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [java-21](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <ø> (-61.63%)` | :arrow_down: |
| [skip-bytebuffers-false](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [skip-bytebuffers-true](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <ø> (-27.73%)` | :arrow_down: |
| [temurin](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <ø> (-61.76%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [unittests1](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [unittests2](https://app.codecov.io/gh/apache/pinot/pull/14856/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/pinot/pull/14856?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
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@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Fix configuration handling during MergeRollupTask execution [pinot]
Posted by "swaminathanmanish (via GitHub)" <gi...@apache.org>.
swaminathanmanish commented on code in PR #14856:
URL: https://github.com/apache/pinot/pull/14856#discussion_r1931783863
##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/mergerollup/MergeRollupTaskUtils.java:
##########
@@ -78,16 +79,59 @@ public static Map<String, Map<String, String>> getLevelToConfigMap(Map<String, S
return levelToConfigMap;
}
+ /**
+ * Returns a lookup key composed of the current merge level / key combination
+ * @param key the key of the value within the task configuration.
+ * @param taskConfig the current merge rollup task configuration used for sourcing the merge level.
+ * @return composite lookup key if the merge level is configured. Otherwise, return original key.
+ */
+ public static String buildMergeLevelKeyPrefix(String key, Map<String, String> taskConfig) {
Review Comment:
Thanks David for the explanation. Would it make sense to add some validation for taskConfig in the task generator (throw exception if invalid) to make sure that aggregation configs are valid, so that the user knows if there are uses during task generation itself. Otherwise we would have to figure out why a particular aggregation did not happen.
##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/mergerollup/MergeRollupTaskUtils.java:
##########
@@ -78,16 +79,59 @@ public static Map<String, Map<String, String>> getLevelToConfigMap(Map<String, S
return levelToConfigMap;
}
+ /**
+ * Returns a lookup key composed of the current merge level / key combination
+ * @param key the key of the value within the task configuration.
+ * @param taskConfig the current merge rollup task configuration used for sourcing the merge level.
+ * @return composite lookup key if the merge level is configured. Otherwise, return original key.
+ */
+ public static String buildMergeLevelKeyPrefix(String key, Map<String, String> taskConfig) {
+ String mergeLevel = taskConfig.get(MinionConstants.MergeRollupTask.MERGE_LEVEL_KEY);
+ if (mergeLevel == null) {
+ return key;
+ } else {
+ return mergeLevel + "." + key;
+ }
+ }
+
/**
* Extracts an array of dimensions to reduce/erase from the task config.
* <p>The config for the dimensions to erase should be a comma-separated string value.
*/
public static Set<String> getDimensionsToErase(Map<String, String> taskConfig) {
- if (taskConfig == null || taskConfig.get(MinionConstants.MergeRollupTask.ERASE_DIMENSION_VALUES_KEY) == null) {
+ if (taskConfig == null) {
return new HashSet<>();
}
- return Arrays.stream(taskConfig.get(MinionConstants.MergeRollupTask.ERASE_DIMENSION_VALUES_KEY).split(","))
+ String key = buildMergeLevelKeyPrefix(MinionConstants.MergeRollupTask.ERASE_DIMENSION_VALUES_KEY, taskConfig);
+ String dimensionsToErase = taskConfig.get(key);
+
+ if (dimensionsToErase == null) {
+ return new HashSet<>();
+ }
+ return Arrays.stream(dimensionsToErase.split(","))
.map(String::trim)
.collect(Collectors.toSet());
}
+
+ /**
+ * Returns a map from column name to the aggregation function parameters associated with it based on the task config.
+ */
+ public static Map<String, Map<String, String>> getAggregationFunctionParameters(Map<String, String> taskConfig) {
+ Map<String, Map<String, String>> aggregationFunctionParameters = new HashMap<>();
+ String prefix = buildMergeLevelKeyPrefix(MergeTask.AGGREGATION_FUNCTION_PARAMETERS_PREFIX, taskConfig);
Review Comment:
Here buildMergeLevelKeyPrefix takes in MergeTask.AGGREGATION_FUNCTION_PARAMETERS_PREFIX as key (aggregationFunctionParameters). Is it expected to return the following prefix if MERGE_LEVEL is specified.
Is this expected?
**hourly. aggregationFunctionParameters** ?
--
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@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Fix configuration handling during MergeRollupTask execution [pinot]
Posted by "swaminathanmanish (via GitHub)" <gi...@apache.org>.
swaminathanmanish merged PR #14856:
URL: https://github.com/apache/pinot/pull/14856
--
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@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Fix configuration handling during MergeRollupTask execution [pinot]
Posted by "davecromberge (via GitHub)" <gi...@apache.org>.
davecromberge commented on code in PR #14856:
URL: https://github.com/apache/pinot/pull/14856#discussion_r1924237325
##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/MergeTaskUtils.java:
##########
@@ -137,28 +137,6 @@ public static Map<String, AggregationFunctionType> getAggregationTypes(Map<Strin
return aggregationTypes;
}
- /**
- * Returns a map from column name to the aggregation function parameters associated with it based on the task config.
- */
- public static Map<String, Map<String, String>> getAggregationFunctionParameters(Map<String, String> taskConfig) {
- Map<String, Map<String, String>> aggregationFunctionParameters = new HashMap<>();
- String prefix = MergeTask.AGGREGATION_FUNCTION_PARAMETERS_PREFIX;
-
- for (Map.Entry<String, String> entry : taskConfig.entrySet()) {
- String key = entry.getKey();
- String value = entry.getValue();
- if (key.startsWith(prefix)) {
- String[] parts = key.substring(prefix.length()).split("\\.", 2);
- if (parts.length == 2) {
- String metricColumn = parts[0];
- String paramName = parts[1];
- aggregationFunctionParameters.computeIfAbsent(metricColumn, k -> new HashMap<>()).put(paramName, value);
- }
- }
- }
- return aggregationFunctionParameters;
- }
-
Review Comment:
This has been moved to the `MergeRollupTaskUtils` helper because it is unique to MergeRollup.
--
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@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Fix configuration handling during MergeRollupTask execution [pinot]
Posted by "swaminathanmanish (via GitHub)" <gi...@apache.org>.
swaminathanmanish commented on code in PR #14856:
URL: https://github.com/apache/pinot/pull/14856#discussion_r1936681099
##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/mergerollup/MergeRollupTaskGenerator.java:
##########
@@ -486,6 +490,58 @@ public List<PinotTaskConfig> generateTasks(List<TableConfig> tableConfigs) {
return pinotTaskConfigs;
}
+ @Override
+ public void validateTaskConfigs(TableConfig tableConfig, Schema schema, Map<String, String> taskConfigs) {
Review Comment:
Looks great. Thanks for adding !
--
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@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Fix configuration handling during MergeRollupTask execution [pinot]
Posted by "davecromberge (via GitHub)" <gi...@apache.org>.
davecromberge commented on code in PR #14856:
URL: https://github.com/apache/pinot/pull/14856#discussion_r1935312657
##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/mergerollup/MergeRollupTaskUtils.java:
##########
@@ -78,16 +79,59 @@ public static Map<String, Map<String, String>> getLevelToConfigMap(Map<String, S
return levelToConfigMap;
}
+ /**
+ * Returns a lookup key composed of the current merge level / key combination
+ * @param key the key of the value within the task configuration.
+ * @param taskConfig the current merge rollup task configuration used for sourcing the merge level.
+ * @return composite lookup key if the merge level is configured. Otherwise, return original key.
+ */
+ public static String buildMergeLevelKeyPrefix(String key, Map<String, String> taskConfig) {
Review Comment:
@swaminathanmanish I have added validation to the task generation - please review.
--
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@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Fix configuration handling during MergeRollupTask execution [pinot]
Posted by "davecromberge (via GitHub)" <gi...@apache.org>.
davecromberge commented on code in PR #14856:
URL: https://github.com/apache/pinot/pull/14856#discussion_r1925535988
##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/mergerollup/MergeRollupTaskUtils.java:
##########
@@ -78,16 +79,59 @@ public static Map<String, Map<String, String>> getLevelToConfigMap(Map<String, S
return levelToConfigMap;
}
+ /**
+ * Returns a lookup key composed of the current merge level / key combination
+ * @param key the key of the value within the task configuration.
+ * @param taskConfig the current merge rollup task configuration used for sourcing the merge level.
+ * @return composite lookup key if the merge level is configured. Otherwise, return original key.
+ */
+ public static String buildMergeLevelKeyPrefix(String key, Map<String, String> taskConfig) {
Review Comment:
@swaminathanmanish From a cursory reading of the existing code, the required keys (during execution) are computed during task generation and inserted into the config without the prefix:
https://github.com/apache/pinot/blob/master/pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/mergerollup/MergeRollupTaskGenerator.java#L711
I can't find a use case in the existing merge rollup execution where the merge level prefixed keys are required. I considered stripping the prefix as noted in the PR description, but this would merely result in re-inserting the same keys without the prefix. Not all values are necessarily recomputed and many remain the same. This also might have broken existing use cases that might expect the presence of the prefix.
> I guess your changes add a new functionality to perform custom transformation based on merge level and thats where this bug is surfaced?
Correct.
--
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@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Fix configuration handling during MergeRollupTask execution [pinot]
Posted by "swaminathanmanish (via GitHub)" <gi...@apache.org>.
swaminathanmanish commented on code in PR #14856:
URL: https://github.com/apache/pinot/pull/14856#discussion_r1925479045
##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/mergerollup/MergeRollupTaskUtils.java:
##########
@@ -78,16 +79,59 @@ public static Map<String, Map<String, String>> getLevelToConfigMap(Map<String, S
return levelToConfigMap;
}
+ /**
+ * Returns a lookup key composed of the current merge level / key combination
+ * @param key the key of the value within the task configuration.
+ * @param taskConfig the current merge rollup task configuration used for sourcing the merge level.
+ * @return composite lookup key if the merge level is configured. Otherwise, return original key.
+ */
+ public static String buildMergeLevelKeyPrefix(String key, Map<String, String> taskConfig) {
Review Comment:
Wouldn't this have been an issue with existing merge rollup without your changes as well ?
I guess your changes add a new functionality to perform custom transformation based on merge level and thats where this bug is surfaced?
"Any lookups on the configuration during task execution have to include the mergeLevel prefix in order to resolve lookups correctly."
--
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@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Fix configuration handling during MergeRollupTask execution [pinot]
Posted by "davecromberge (via GitHub)" <gi...@apache.org>.
davecromberge commented on code in PR #14856:
URL: https://github.com/apache/pinot/pull/14856#discussion_r1925535988
##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/mergerollup/MergeRollupTaskUtils.java:
##########
@@ -78,16 +79,59 @@ public static Map<String, Map<String, String>> getLevelToConfigMap(Map<String, S
return levelToConfigMap;
}
+ /**
+ * Returns a lookup key composed of the current merge level / key combination
+ * @param key the key of the value within the task configuration.
+ * @param taskConfig the current merge rollup task configuration used for sourcing the merge level.
+ * @return composite lookup key if the merge level is configured. Otherwise, return original key.
+ */
+ public static String buildMergeLevelKeyPrefix(String key, Map<String, String> taskConfig) {
Review Comment:
@swaminathanmanish From a cursory reading of the existing code, the required keys are computed during task generation and inserted into the config without the prefix:
https://github.com/apache/pinot/blob/master/pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/mergerollup/MergeRollupTaskGenerator.java#L711
I can't find a use case in the existing merge rollup execution where the merge level prefixed keys are required. I considered stripping the prefix as noted in the PR description, but this would merely result in re-inserting the same keys without the prefix. Not all values are necessarily recomputed and many remain the same. This also might have broken existing use cases that might expect the presence of the prefix.
> I guess your changes add a new functionality to perform custom transformation based on merge level and thats where this bug is surfaced?
Correct.
--
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@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Fix configuration handling during MergeRollupTask execution [pinot]
Posted by "davecromberge (via GitHub)" <gi...@apache.org>.
davecromberge commented on code in PR #14856:
URL: https://github.com/apache/pinot/pull/14856#discussion_r1932256452
##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/mergerollup/MergeRollupTaskUtils.java:
##########
@@ -78,16 +79,59 @@ public static Map<String, Map<String, String>> getLevelToConfigMap(Map<String, S
return levelToConfigMap;
}
+ /**
+ * Returns a lookup key composed of the current merge level / key combination
+ * @param key the key of the value within the task configuration.
+ * @param taskConfig the current merge rollup task configuration used for sourcing the merge level.
+ * @return composite lookup key if the merge level is configured. Otherwise, return original key.
+ */
+ public static String buildMergeLevelKeyPrefix(String key, Map<String, String> taskConfig) {
+ String mergeLevel = taskConfig.get(MinionConstants.MergeRollupTask.MERGE_LEVEL_KEY);
+ if (mergeLevel == null) {
+ return key;
+ } else {
+ return mergeLevel + "." + key;
+ }
+ }
+
/**
* Extracts an array of dimensions to reduce/erase from the task config.
* <p>The config for the dimensions to erase should be a comma-separated string value.
*/
public static Set<String> getDimensionsToErase(Map<String, String> taskConfig) {
- if (taskConfig == null || taskConfig.get(MinionConstants.MergeRollupTask.ERASE_DIMENSION_VALUES_KEY) == null) {
+ if (taskConfig == null) {
return new HashSet<>();
}
- return Arrays.stream(taskConfig.get(MinionConstants.MergeRollupTask.ERASE_DIMENSION_VALUES_KEY).split(","))
+ String key = buildMergeLevelKeyPrefix(MinionConstants.MergeRollupTask.ERASE_DIMENSION_VALUES_KEY, taskConfig);
+ String dimensionsToErase = taskConfig.get(key);
+
+ if (dimensionsToErase == null) {
+ return new HashSet<>();
+ }
+ return Arrays.stream(dimensionsToErase.split(","))
.map(String::trim)
.collect(Collectors.toSet());
}
+
+ /**
+ * Returns a map from column name to the aggregation function parameters associated with it based on the task config.
+ */
+ public static Map<String, Map<String, String>> getAggregationFunctionParameters(Map<String, String> taskConfig) {
+ Map<String, Map<String, String>> aggregationFunctionParameters = new HashMap<>();
+ String prefix = buildMergeLevelKeyPrefix(MergeTask.AGGREGATION_FUNCTION_PARAMETERS_PREFIX, taskConfig);
Review Comment:
Yes. The customisation to the merge rollup behaviour is based on merge level. The current level is extracted from the configuration in the `buildMergeLevelKeyPrefix` helper function. It is a convenience to scope any configuration lookups to the current level.
Another design consideration would have been to strip the level prefix entirely from the task configuration and merge with the rest of the configuration. This assumes that a single task is scoped to a level. However, as described in the PR this would potentially break existing implementations.
--
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@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org