Skip to content

[SPARK-56960][SQL][TESTS] Support custom Ivy settings file in HiveVersionSuite via environment variable#56003

Open
sarutak wants to merge 2 commits into
apache:masterfrom
sarutak:hive-test-ivy-settings-env
Open

[SPARK-56960][SQL][TESTS] Support custom Ivy settings file in HiveVersionSuite via environment variable#56003
sarutak wants to merge 2 commits into
apache:masterfrom
sarutak:hive-test-ivy-settings-env

Conversation

@sarutak
Copy link
Copy Markdown
Member

@sarutak sarutak commented May 20, 2026

What changes were proposed in this pull request?

This PR adds support for the SPARK_VERSIONS_SUITE_IVY_SETTINGS environment variable in HiveClientBuilder. When set, its value is used as the path to a custom Ivy settings file (spark.jars.ivySettings) for Hive metastore jar resolution during tests.

Why are the changes needed?

After SPARK-56867(#55881) added support for spark.jars.ivySettings in IsolatedClientLoader, the test infrastructure should also be able to leverage this configuration. In closed environments where only authenticated private repositories are accessible, tests that download Hive metastore jars (e.g., HiveClientSuite, HivePartitionFilteringSuite) would fail without a way to specify credentials. This environment variable allows such environments to provide a custom Ivy settings file with the necessary authentication configuration.

This follows the same pattern as the existing SPARK_VERSIONS_SUITE_IVY_PATH environment variable, which allows specifying a custom Ivy cache path for the same set of tests.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Confirmed it works with a private repository which requires authentication.

$ SPARK_VERSIONS_SUITE_IVY_SETTINGS=/path/to/ivy-settings.xml build/sbt 'testOnly org.apache.spark.sql.hive.client.HivePartitionLocationSuites'

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude (via Kiro CLI, auto model selection)

// Path to a custom Ivy settings file for testing in environments that require
// authenticated access to private repositories:
private val ivySettingsPath: Option[String] =
sys.env.get("SPARK_VERSIONS_SUITE_IVY_SETTINGS")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the following not working?

$ mvn test -Dspark.jars.ivySettings=xxx
$ sbt -Dspark.jars.ivySettings=xxx test

Copy link
Copy Markdown
Member Author

@sarutak sarutak May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System properties aren't propagated to forked test JVMs right?

hadoopConf: Configuration,
extraConf: Map[String, String] = Map.empty): HiveClient = {
val sparkConf = new SparkConf()
ivySettingsPath.foreach(sparkConf.set(MavenUtils.JAR_IVY_SETTING_PATH_KEY, _))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, set -> setIfMissing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants