github-advanced-security[bot] commented on code in PR #16291:
URL: https://github.com/apache/druid/pull/16291#discussion_r1566757328
##########
server/src/main/java/org/apache/druid/server/coordinator/DataSourceCompactionConfig.java:
##########
@@ -209,9 +225,75 @@
dimensionsSpec,
transformSpec,
ioConfig,
- taskContext
+ taskContext,
+ engine
);
result = 31 * result + Arrays.hashCode(metricsSpec);
return result;
}
+
+ public static DataSourceCompactionConfig from(Engine defaultEngine,
DataSourceCompactionConfig currentConfig)
+ {
+ Engine newEngine = currentConfig.getEngine();
+ String engineSourceLog = "specified in spec";
+ if (newEngine == null) {
+ newEngine = defaultEngine;
+ engineSourceLog = "set as default";
+ }
+ if (newEngine == Engine.MSQ) {
+ if (currentConfig.getTuningConfig() != null) {
+ PartitionsSpec partitionsSpec =
currentConfig.getTuningConfig().getPartitionsSpec();
+
+ if (partitionsSpec != null && !(partitionsSpec instanceof
DimensionRangePartitionsSpec
+ || partitionsSpec instanceof
DynamicPartitionsSpec)) {
+ throw InvalidInput.exception(
+ "Invalid partition spec type[%s] for MSQ compaction engine %s."
+ + " Type must be either DynamicPartitionsSpec or
DynamicRangePartitionsSpec.",
+ partitionsSpec.getClass(),
+ engineSourceLog
+ );
+ }
+ if (partitionsSpec instanceof DynamicPartitionsSpec
+ && ((DynamicPartitionsSpec) partitionsSpec).getMaxTotalRows() !=
null) {
+ throw InvalidInput.exception(
+ "maxTotalRows[%d] in DynamicPartitionsSpec not supported for MSQ
compaction engine %s.",
+ ((DynamicPartitionsSpec) partitionsSpec).getMaxTotalRows(),
engineSourceLog
+ );
+ }
+ }
+ }
+ return new DataSourceCompactionConfig(
+ currentConfig.getDataSource(),
+ currentConfig.getTaskPriority(),
+ currentConfig.getInputSegmentSizeBytes(),
+ currentConfig.getMaxRowsPerSegment(),
Review Comment:
## Deprecated method or constructor invocation
Invoking [DataSourceCompactionConfig.getMaxRowsPerSegment](1) should be
avoided because it has been deprecated.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7283)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]