mosche commented on code in PR #24862:
URL: https://github.com/apache/beam/pull/24862#discussion_r1067148162
##########
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
+
+ if (options != null) {
+ sparkConf.setAppName(options.getAppName());
Review Comment:
`PipelineOptionsFactory` will always set an appName and according to the
interface contract it shouldn't be null. But i can add that check 👍
--
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]