spark-instrumented-optimizer/project
Kousuke Saruta 05c6b8acdc [SPARK-35921][BUILD] ${spark.yarn.isHadoopProvided} in config.properties is not edited if build with SBT
### What changes were proposed in this pull request?

This PR changes `SparkBuild.scala` to edit `config.properties` in `yarn` sub-module in build with SBT like as build with Maven does.

### Why are the changes needed?

yarn sub-module contains config.properties.
```
spark.yarn.isHadoopProvided = ${spark.yarn.isHadoopProvided}
```

The `${spark.yarn.isHadoopProvided}` part is replaced with `true` or `false` in build depending on whether Hadoop is provided or not (specified by -Phadoop-provided).
The edited config.properties will be loaded at runtime to control how to populate Hadoop-related classpath.

If we build with Maven, these process works but doesn't with SBT.

If we build with SBT and deploy apps on YARN, the following warning appears and classpath is not populated correctly.
```
21/06/29 10:51:20 WARN config.package: Can not load the default value of `spark.yarn.isHadoopProvided` from `org/apache/spark/deploy/yarn/config.properties` with error, java.lang.IllegalArgumentException: For input string: "${spark.yarn.isHadoopProvided}". Using `false` as a default value.
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Built with SBT and extracted `config.properties` from the build artifact and confirmed `${spark.yarn.isHadoopProvided} was correctly edited with `true` or `false`.
```
cat org/apache/spark/deploy/yarn/config.properties
spark.yarn.isHadoopProvided = false                                # In case build with -Pyarn and without -Phadoop-provided
spark.yarn.isHadoopProvided = true                                 # In case build with -Pyarn and -Phadoop-provided
```
I also confirmed the warning message shown above no longer appears.

Closes #33121 from sarutak/sbt-yarn-config-properties.

Authored-by: Kousuke Saruta <sarutak@oss.nttdata.com>
Signed-off-by: DB Tsai <d_tsai@apple.com>
2021-06-29 21:25:31 +00:00
..
build.properties [SPARK-35818][BUILD] Upgrade SBT to 1.5.4 2021-06-19 00:17:35 -07:00
MimaBuild.scala [SPARK-21708][BUILD] Migrate build to sbt 1.x 2020-10-07 15:28:00 -07:00
MimaExcludes.scala [SPARK-35757][CORE] Add bitwise AND operation and functionality for intersecting bloom filters 2021-06-17 06:29:33 +00:00
plugins.sbt [SPARK-35928][BUILD] Upgrade ASM to 9.1 2021-06-29 10:27:51 -07:00
SparkBuild.scala [SPARK-35921][BUILD] ${spark.yarn.isHadoopProvided} in config.properties is not edited if build with SBT 2021-06-29 21:25:31 +00:00