mosche commented on code in PR #24862:
URL: https://github.com/apache/beam/pull/24862#discussion_r1067141411
##########
runners/spark/3/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/SparkSessionFactory.java:
##########
@@ -95,24 +122,37 @@ public static SparkSession
getOrCreateSession(SparkStructuredStreamingPipelineOp
if (options.getUseActiveSparkSession()) {
return SparkSession.active();
}
- return sessionBuilder(options.getSparkMaster(), options.getAppName(),
options.getFilesToStage())
- .getOrCreate();
+ return sessionBuilder(options.getSparkMaster(), options).getOrCreate();
}
/** Creates Spark session builder with some optimizations for local mode,
e.g. in tests. */
public static SparkSession.Builder sessionBuilder(String master) {
- return sessionBuilder(master, null, null);
+ return sessionBuilder(master, null);
}
private static SparkSession.Builder sessionBuilder(
- String master, @Nullable String appName, @Nullable List<String> jars) {
- SparkConf sparkConf = new SparkConf();
- sparkConf.setMaster(master);
- if (appName != null) {
- sparkConf.setAppName(appName);
- }
- if (jars != null && !jars.isEmpty()) {
- sparkConf.setJars(jars.toArray(new String[0]));
+ String master, @Nullable SparkStructuredStreamingPipelineOptions
options) {
+
+ SparkConf sparkConf = new SparkConf().setIfMissing("spark.master", master);
+ master = sparkConf.get("spark.master"); // update to effective master
Review Comment:
The intent is not to update the pipeline option, but to use a consistent
view on the value of master in the remainder of this method (e.g. to calculate
local partitions). At this point the value in pipeline options doesn't matter
anymore.
--
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]