tedyu commented on code in PR #9904:
URL: https://github.com/apache/gravitino/pull/9904#discussion_r2801200523
##########
maintenance/optimizer/src/main/java/org/apache/gravitino/maintenance/optimizer/recommender/job/GravitinoJobSubmitter.java:
##########
@@ -79,11 +89,67 @@ public void close() throws Exception {
}
}
+ private void ensureClientInitialized() {
+ if (gravitinoClient == null) {
+ if (optimizerEnv == null) {
+ throw new IllegalStateException("Job submitter is not initialized");
+ }
+ this.gravitinoClient = GravitinoClientUtils.createClient(optimizerEnv);
+ }
+ }
+
+ /**
+ * Merge job configs with precedence: optimizer config < adapter config.
+ *
+ * <p>Typical use cases:
+ *
+ * <ul>
+ * <li>Optimizer config: shared engine/runtime defaults (for example,
Spark settings).
+ * <li>Adapter config: adapter-specific parameters (for example, WHERE
filters) required by the
+ * job template.
+ * </ul>
+ */
+ @VisibleForTesting
+ static Map<String, String> buildJobConfig(
+ OptimizerConfig optimizerConfig,
+ JobExecutionContext jobExecutionContext,
+ GravitinoJobAdapter jobAdapter) {
+ Map<String, String> submitterConfigs =
+ optimizerConfig == null ? Map.of() :
optimizerConfig.jobSubmitterConfigs();
+ Map<String, String> adapterConfigs =
+ jobAdapter == null ? Map.of() :
jobAdapter.jobConfig(jobExecutionContext);
+
+ Map<String, String> mergedConfigs = new LinkedHashMap<>();
+ mergedConfigs.putAll(submitterConfigs);
Review Comment:
Is it possible that there is overlap between the keys of submitterConfigs
and adapterConfigs ?
--
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]