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

danny0405 pushed a commit to branch release-1.1.2
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/release-1.1.2 by this push:
     new fa4f78a5b3a4 fix(ci): isolate Spark merge contexts and repair Trino 
test infrastructure
fa4f78a5b3a4 is described below

commit fa4f78a5b3a46a47accb4e83fbf5a9ea779574c3
Author: danny0405 <[email protected]>
AuthorDate: Sat Oct 10 12:26:47 2026 +0800

    fix(ci): isolate Spark merge contexts and repair Trino test infrastructure
    
    Use iterator-local record contexts, upgrade the SPI checker to resolve 
repository descriptors, and replace the unavailable MinIO test image. Print 
HDFS daemon logs on failure to diagnose the remaining CI-only startup error.
---
 .../src/main/scala/org/apache/hudi/Iterators.scala |  5 +--
 hudi-trino-plugin/pom.xml                          | 13 +++++++
 .../hudi/testing/MinioImageNameSubstitutor.java    | 40 ++++++++++++++++++++++
 .../src/test/resources/testcontainers.properties   | 14 ++++++++
 .../docker_java17/docker_java17_test.sh            | 12 ++++++-
 5 files changed, 81 insertions(+), 3 deletions(-)

diff --git 
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/Iterators.scala
 
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/Iterators.scala
index a6e158f1bc10..6b3a96d4c98d 100644
--- 
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/Iterators.scala
+++ 
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/Iterators.scala
@@ -270,8 +270,9 @@ class RecordMergingFileIterator(logFiles: 
List[HoodieLogFile],
   private val recordMerger = 
HoodieRecordUtils.createRecordMerger(tableState.tablePath, EngineType.SPARK,
     tableState.recordMergeImplClasses.asJava, tableState.recordMergeStrategyId)
 
-  private val rowRecordContext: RecordContext[InternalRow] = 
SparkFileFormatInternalRecordContext.getFieldAccessorInstance
-  private val avroRecordContext: RecordContext[IndexedRecord] = 
AvroRecordContext.getFieldAccessorInstance
+  // Merging caches schema IDs and serializers; these contexts must not be 
shared across Spark tasks.
+  private val rowRecordContext: RecordContext[InternalRow] = 
SparkFileFormatInternalRecordContext()
+  private val avroRecordContext: RecordContext[IndexedRecord] = new 
AvroRecordContext()
   private val orderingFields: Array[String] = tableState.orderingFields.toArray
 
   override def doHasNext: Boolean = hasNextInternal
diff --git a/hudi-trino-plugin/pom.xml b/hudi-trino-plugin/pom.xml
index 3a30e4750d82..b1703598b616 100644
--- a/hudi-trino-plugin/pom.xml
+++ b/hudi-trino-plugin/pom.xml
@@ -202,6 +202,7 @@
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-annotations</artifactId>
+            <scope>provided</scope>
         </dependency>
 
         <dependency>
@@ -457,10 +458,22 @@
             <artifactId>junit-jupiter-params</artifactId>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.testcontainers</groupId>
+            <artifactId>testcontainers</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>io.trino</groupId>
+                <artifactId>trino-maven-plugin</artifactId>
+                <!-- Version 17 resolves the SPI descriptor using the 
project's repositories. -->
+                <version>17</version>
+            </plugin>
             <plugin>
                 <groupId>org.basepom.maven</groupId>
                 <artifactId>duplicate-finder-maven-plugin</artifactId>
diff --git 
a/hudi-trino-plugin/src/test/java/io/trino/plugin/hudi/testing/MinioImageNameSubstitutor.java
 
b/hudi-trino-plugin/src/test/java/io/trino/plugin/hudi/testing/MinioImageNameSubstitutor.java
new file mode 100644
index 000000000000..5533fade45ce
--- /dev/null
+++ 
b/hudi-trino-plugin/src/test/java/io/trino/plugin/hudi/testing/MinioImageNameSubstitutor.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.trino.plugin.hudi.testing;
+
+import org.testcontainers.utility.DockerImageName;
+import org.testcontainers.utility.ImageNameSubstitutor;
+
+public class MinioImageNameSubstitutor
+        extends ImageNameSubstitutor
+{
+    // Use the pinned MinIO image from Trino's current test infrastructure.
+    private static final DockerImageName MINIO_IMAGE = DockerImageName.parse(
+            
"cgr.dev/chainguard/minio@sha256:6a1d0b45c8669726bba580ced0bfa4cb9fdeed1ed636dfabd81d1577beb6937b");
+
+    @Override
+    public DockerImageName apply(DockerImageName original)
+    {
+        if (original.getRepository().equals("minio/minio")) {
+            return MINIO_IMAGE.asCompatibleSubstituteFor(original);
+        }
+        return original;
+    }
+
+    @Override
+    protected String getDescription()
+    {
+        return "Use the available MinIO test image";
+    }
+}
diff --git a/hudi-trino-plugin/src/test/resources/testcontainers.properties 
b/hudi-trino-plugin/src/test/resources/testcontainers.properties
new file mode 100644
index 000000000000..2844ce763f9d
--- /dev/null
+++ b/hudi-trino-plugin/src/test/resources/testcontainers.properties
@@ -0,0 +1,14 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+image.substitutor=io.trino.plugin.hudi.testing.MinioImageNameSubstitutor
diff --git a/packaging/bundle-validation/docker_java17/docker_java17_test.sh 
b/packaging/bundle-validation/docker_java17/docker_java17_test.sh
index dfbb427c6713..9d14ceb321e4 100755
--- a/packaging/bundle-validation/docker_java17/docker_java17_test.sh
+++ b/packaging/bundle-validation/docker_java17/docker_java17_test.sh
@@ -105,6 +105,16 @@ stop_hdfs() {
   HADOOP_PID_DIR="$DOCKER_TEST_DIR/pid/namenode" "$HADOOP_HOME/bin/hdfs" 
--daemon stop namenode
 }
 
+cleanup_hdfs() {
+  local exit_code=$?
+  if [ "$exit_code" -ne 0 ]; then
+    # Daemon startup errors are redirected to these files by Hadoop's launcher.
+    tail -n 100 "$HADOOP_HOME"/logs/*.log "$HADOOP_HOME"/logs/*.out
+  fi
+  stop_hdfs
+  return "$exit_code"
+}
+
 build_hudi () {
   if [ "$SPARK_PROFILE" = "spark4.0" ]; then
     change_java_runtime_version
@@ -170,7 +180,7 @@ echo "::warning::docker_test_java17.sh Building Hudi"
 build_hudi
 echo "::warning::docker_test_java17.sh Done building Hudi"
 
-trap stop_hdfs EXIT
+trap cleanup_hdfs EXIT
 setup_hdfs || exit 1
 
 echo "::warning::docker_test_java17.sh Running tests with Java 17"

Reply via email to