echauchot commented on code in PR #24862:
URL: https://github.com/apache/beam/pull/24862#discussion_r1068093562
##########
runners/spark/3/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/SparkSessionFactory.java:
##########
@@ -130,19 +170,35 @@ private static SparkSession.Builder sessionBuilder(
// mode, so try to align with value of "sparkMaster" option in this case.
// We should not overwrite this value (or any user-defined spark
configuration value) if the
// user has already configured it.
- if (master != null
- && !master.equals("local[*]")
- && master.startsWith("local[")
- && System.getProperty("spark.sql.shuffle.partitions") == null) {
- int numPartitions =
- Integer.parseInt(master.substring("local[".length(), master.length()
- 1));
- if (numPartitions > 0) {
- sparkConf.set("spark.sql.shuffle.partitions",
String.valueOf(numPartitions));
- }
+ int partitions = localNumPartitions(master);
+ if (partitions > 0) {
+ sparkConf.setIfMissing("spark.sql.shuffle.partitions",
Integer.toString(partitions));
}
+
return SparkSession.builder().config(sparkConf);
}
+ @SuppressWarnings({"return", "toarray.nullable.elements",
"methodref.receiver"}) // safe to ignore
+ private static String[] filesToStage(
Review Comment:
perfect. Indeed I wanted to make the fact that it filters cristal clear
--
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]