infvg commented on code in PR #13224:
URL: https://github.com/apache/gluten/pull/13224#discussion_r4251106697


##########
backends-velox/pom.xml:
##########
@@ -581,6 +632,114 @@
           <scope>test</scope>
         </dependency>
       </dependencies>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-antrun-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>compile-iceberg-coverage-listener</id>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+                <phase>process-test-classes</phase>
+                <configuration>
+                  <target>
+                    <!-- Compile only the observer and its tests, without 
copied upstream classes. -->
+                    <mkdir dir="${iceberg.upstream.test.classes}"/>
+                    <!-- Some upstream tests resolve classpath fixtures as 
filesystem paths. -->
+                    <unzip dest="${iceberg.upstream.test.classes}">
+                      <restrict>
+                        <path refid="maven.test.classpath"/>
+                        <name name="**/org/apache/iceberg/*-tests.jar"/>
+                      </restrict>
+                      <patternset 
excludes="**/*.class,META-INF/**,LICENSE,NOTICE,iceberg-build.properties"/>
+                    </unzip>
+                    <javac destdir="${iceberg.upstream.test.classes}" 
encoding="UTF-8" includeantruntime="false" release="17">
+                      <src 
path="${project.basedir}/src-iceberg-upstream/test/java"/>
+                      <src 
path="${project.basedir}/../gluten-ut/src-iceberg-upstream/test/java"/>
+                      <classpath refid="maven.test.classpath"/>
+                    </javac>
+                    <copy todir="${iceberg.upstream.test.classes}">
+                      <fileset 
dir="${project.basedir}/src-iceberg-upstream/test/resources"/>
+                    </copy>
+                  </target>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>iceberg-upstream</id>
+                <configuration>
+                  <!-- Only the coverage listener is shared with the unchanged 
upstream tests. -->
+                  
<testClassesDirectory>${iceberg.upstream.test.classes}</testClassesDirectory>
+                  <classpathDependencyExcludes>
+                    
<classpathDependencyExclude>org.apache.iceberg:iceberg-spark-runtime-*</classpathDependencyExclude>
+                    
<classpathDependencyExclude>org.apache.avro:avro</classpathDependencyExclude>
+                    
<classpathDependencyExclude>org.apache.parquet:*</classpathDependencyExclude>
+                    
<classpathDependencyExclude>org.apache.datasketches:*</classpathDependencyExclude>
+                    
<classpathDependencyExclude>org.apache.orc:orc-core</classpathDependencyExclude>
+                    
<classpathDependencyExclude>org.apache.orc:orc-shims</classpathDependencyExclude>
+                    
<classpathDependencyExclude>org.mockito:*</classpathDependencyExclude>
+                    
<classpathDependencyExclude>net.bytebuddy:*</classpathDependencyExclude>
+                    
<classpathDependencyExclude>org.objenesis:*</classpathDependencyExclude>
+                  </classpathDependencyExcludes>
+                  <!-- Use Iceberg's Avro, Parquet, DataSketches and nohive 
ORC runtime. -->
+                  <additionalClasspathDependencies>
+                    <dependency>
+                      <groupId>org.apache.iceberg</groupId>
+                      
<artifactId>iceberg-spark-${sparkbundle.version}_${scala.binary.version}</artifactId>
+                      <version>${iceberg.version}</version>
+                    </dependency>
+                    <!-- Iceberg 1.10/1.11 use Mockito 4.11, including static 
mocks. -->
+                    <dependency>
+                      <groupId>org.mockito</groupId>
+                      <artifactId>mockito-inline</artifactId>
+                      <version>4.11.0</version>
+                    </dependency>
+                  </additionalClasspathDependencies>

Review Comment:
   the parent uses surefire 3.5.6 so this is supported



##########
.github/workflows/util/iceberg-upstream/summarize.py:
##########
@@ -0,0 +1,223 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+"""Join execution evidence with JUnit outcomes; missing evidence is never a 
native pass."""
+
+import collections
+import csv
+import json
+import os
+from pathlib import Path
+import sys
+import xml.etree.ElementTree as ET
+
+STATUSES = (
+    "PASSED_NATIVE",
+    "PASSED_FALLBACK",
+    "FAILED",
+    "NO_ICEBERG_EXECUTION",
+    "PASSED_UNVERIFIED",
+    "SKIPPED",
+    "COVERAGE_ERROR",
+)
+REPORT_VERSION = 2
+
+
+def native_proven(row):
+    return (
+        row.get("body_started") is True
+        and bool(row.get("native"))
+        and not row.get("fallback")
+        and not row.get("unverified")
+        and not row.get("failed_queries")
+        and not row.get("expected_exception")
+        and all(
+            any(value > 0 for value in entry.get("metrics", {}).values())
+            for entry in row.get("native_metrics", [])
+        )
+        and set(row["native"])
+        <= {entry.get("node") for entry in row.get("native_metrics", [])}
+    )
+
+
+def classify(directory):
+    evidence = {}
+    for path in sorted(directory.glob("coverage-*.jsonl")):
+        for line in path.read_text().splitlines():
+            row = json.loads(line)
+            # Surefire drops empty parentheses for ordinary @Test methods, but 
retains the
+            # signature and invocation index for parameterized/template tests.
+            name = row["name"]
+            key = (row["class"], name[:-2] if name.endswith("()") else name)
+            if key in evidence:
+                raise ValueError(f"Duplicate execution coverage for {key}")
+            evidence[key] = row
+
+    results, seen = [], set()
+    for path in sorted(directory.glob("TEST-*.xml")):
+        for test in ET.parse(path).getroot().iter("testcase"):
+            key = (test.get("classname", ""), test.get("name", ""))
+            if not key[0].startswith("org.apache.iceberg."):
+                continue
+            if key in seen:
+                raise ValueError(f"Duplicate JUnit result: {key}")
+            seen.add(key)
+            row = dict(evidence.get(key, {}), **{"class": key[0], "name": 
key[1]})
+            failure = test.find("failure")
+            if failure is None:
+                failure = test.find("error")
+            if failure is not None:
+                row.update(
+                    status="FAILED",
+                    failure=failure.get("message", ""),
+                    failure_type=failure.get("type", ""),
+                )
+                if key not in evidence:
+                    row["coverage_error"] = (
+                        "Failure before per-test observation; check test setup 
or fork logs"
+                    )
+            elif test.find("skipped") is not None:
+                row["status"] = "SKIPPED"
+            elif row.get("coverage_error") or row.get("status") not in (
+                "PASSED_NATIVE",
+                "PASSED_FALLBACK",
+                "NO_ICEBERG_EXECUTION",
+                "PASSED_UNVERIFIED",
+            ):
+                row["coverage_error"] = (
+                    row.get("coverage_error")
+                    or "Missing or inconsistent execution evidence"
+                )
+            elif row["status"] == "PASSED_NATIVE" and not native_proven(row):
+                row["coverage_error"] = (
+                    "Native label without successful test-body executor 
evidence"
+                )
+            if row.get("coverage_error"):
+                row["status"] = "COVERAGE_ERROR"
+            results.append(row)
+    if not results:
+        raise ValueError("No upstream Iceberg JUnit results found")
+    if evidence.keys() - seen:
+        raise ValueError(
+            f"Execution evidence without JUnit result: {sorted(evidence.keys() 
- seen)}"
+        )
+    return results
+
+
+def write_reports(directory, results, label="Iceberg execution coverage"):
+    counts = collections.Counter(row["status"] for row in results)
+    summary = {status: counts[status] for status in STATUSES}
+    (directory / "execution-coverage.json").write_text(
+        json.dumps(
+            {
+                "version": REPORT_VERSION,
+                "scope": "test-body Iceberg I/O",
+                "counts": summary,
+                "tests": results,
+            },
+            indent=2,
+        )
+        + "\n"
+    )
+    columns = (
+        "status",
+        "class",
+        "test",
+        "parameters",
+        "parameter_values",

Review Comment:
   fixed



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to