This is an automated email from the ASF dual-hosted git repository.

voonhous pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 8e884960820a fix(spark): keep the embedded Derby metastore out of the 
RAT check (#19792)
8e884960820a is described below

commit 8e884960820a081e34cdce8e78505e9ed54dff28
Author: voonhous <[email protected]>
AuthorDate: Sun Aug 30 01:45:58 2026 +0800

    fix(spark): keep the embedded Derby metastore out of the RAT check (#19792)
    
    Since #19162 runs TestSparkCatalogMetaStoreClient in CI, its 
enableHiveSupport()
    session writes Derby's metastore_db/ into the hudi-spark module directory, 
and the
    next maven invocation in the same job fails the RAT check on the unlicensed 
database
    files ("Files with unapproved licenses: .../hudi-spark/metastore_db/db.lck 
...").
    
    Exclude **/metastore_db/** from RAT in the root pom so any Hive-enabled 
test is safe,
    and point the test's metastore at a temp directory 
(javax.jdo.option.ConnectionURL
    and derby.system.home, deleted in afterAll) so nothing is left in the tree 
at all.
---
 .../apache/spark/sql/hive/TestSparkCatalogMetaStoreClient.scala    | 7 +++++++
 pom.xml                                                            | 2 ++
 2 files changed, 9 insertions(+)

diff --git 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hive/TestSparkCatalogMetaStoreClient.scala
 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hive/TestSparkCatalogMetaStoreClient.scala
index 1e6dc3ce21d3..c0d8201edd05 100644
--- 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hive/TestSparkCatalogMetaStoreClient.scala
+++ 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hive/TestSparkCatalogMetaStoreClient.scala
@@ -46,14 +46,20 @@ import scala.collection.JavaConverters._
 class TestSparkCatalogMetaStoreClient extends FunSuite with BeforeAndAfterAll {
 
   private val warehouseDir = 
Files.createTempDirectory("spark-catalog-metastore-client").toFile
+  // Keep the embedded Derby metastore (and derby.log) out of the module 
directory, where the
+  // RAT check would otherwise flag the unlicensed database files.
+  private val metastoreDir = 
Files.createTempDirectory("spark-catalog-metastore-db").toFile
   private val nameId = new AtomicInteger(0)
 
   private lazy val spark: SparkSession = {
     val sparkConf = getSparkConfForTest("TestSparkCatalogMetaStoreClient")
       .remove("spark.sql.catalog.spark_catalog")
 
+    System.setProperty("derby.system.home", metastoreDir.getCanonicalPath)
     SparkSession.builder()
       .config("spark.sql.warehouse.dir", warehouseDir.getCanonicalPath)
+      .config("spark.hadoop.javax.jdo.option.ConnectionURL",
+        s"jdbc:derby:;databaseName=${new File(metastoreDir, 
"metastore_db").getCanonicalPath};create=true")
       .config("spark.sql.session.timeZone", "UTC")
       .config(sparkConf)
       .enableHiveSupport()
@@ -73,6 +79,7 @@ class TestSparkCatalogMetaStoreClient extends FunSuite with 
BeforeAndAfterAll {
       spark.stop()
     }
     Utils.deleteRecursively(warehouseDir)
+    Utils.deleteRecursively(metastoreDir)
     super.afterAll()
   }
 
diff --git a/pom.xml b/pom.xml
index 53ab25ea108a..1a9fee33b5a9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -704,6 +704,8 @@
               <exclude>**/*.json</exclude>
               <exclude>**/*.hfile</exclude>
               <exclude>**/*.log</exclude>
+              <!-- embedded Derby metastore created by Hive-enabled Spark 
tests -->
+              <exclude>**/metastore_db/**</exclude>
               <exclude>**/*.sqltemplate</exclude>
               <exclude>**/compose_env</exclude>
               <exclude>**/main/resources/version.txt</exclude>

Reply via email to