comphead commented on code in PR #5841: URL: https://github.com/apache/datafusion-comet/pull/5841#discussion_r4743965296
########## .github/workflows/pr_build_linux_checks.yml: ########## @@ -0,0 +1,318 @@ +# 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. + +name: PR Checks (Linux) + +# Independent lint, compilation, compatibility, and Rust debug checks. +# Run alongside the shared native producer; these jobs do not consume its artifact. +# Triggering and path filters live in the umbrella workflow. +on: + workflow_call: + inputs: + cache-refresh-only: + description: 'Skip independent checks on cache-only pushes' + type: boolean + default: false + profiles: + description: 'Linux profile selection; nightly skips checks already run at this commit' + type: string + default: 'all' + +permissions: + contents: read + +env: + RUST_VERSION: stable + RUST_BACKTRACE: 1 + # Force GNU ld on Linux: recent Rust stable defaults to rust-lld on + # x86_64-unknown-linux-gnu, and rust-lld cannot resolve -ljvm against the + # Zulu JDK layout installed by setup-java. Keep bfd for all cargo invocations. + RUSTFLAGS: "-Clink-arg=-fuse-ld=bfd" + +jobs: + lint: + if: ${{ !inputs.cache-refresh-only }} + name: Lint + runs-on: ubuntu-24.04 + container: + image: amd64/rust + steps: + - uses: actions/checkout@v7 + + - name: Check Rust formatting + run: | + rustup component add rustfmt + cd native && cargo fmt --all -- --check + + # Fast syntactic-only scalafix check. Parses sources without compiling, so it + # surfaces version-independent style issues (e.g. RedundantSyntax) in seconds, + # long before the lint-java matrix finishes its ~3.5 min build. The full rule + # set, including the semantic rules, runs in lint-java. + scalafix-syntactic: + name: Lint Scala (syntactic) + if: ${{ !inputs.cache-refresh-only && inputs.profiles != 'nightly' }} + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + + - name: Setup coursier + uses: coursier/setup-action@v3 + with: + jvm: temurin:21 + + # Split the network from the lint. `cs launch` resolves and downloads the + # scalafix artifacts from Maven Central, which resets connections now and + # then, so the warm-up retries a no-op `--version` run. The real check then + # runs `--mode offline` against the populated cache: no network, and a + # nonzero exit can only mean a lint violation, never a download failure. + - name: Fetch scalafix + run: | + for attempt in 1 2 3; do + if cs launch scalafix:0.14.6 -- --version; then + break + fi + if [ "$attempt" = 3 ]; then + echo "::error::scalafix download failed after 3 attempts." + exit 1 + fi + echo "::warning::scalafix download failed (attempt $attempt of 3); retrying in $((attempt * 15))s." + sleep $((attempt * 15)) + done + + - name: Run syntactic scalafix check (no compile) + run: | + cs launch --mode offline scalafix:0.14.6 -- \ + --check \ + --syntactic \ + --config .scalafix-syntactic.conf \ + --exclude '**/target/**' \ + spark + + lint-java: + needs: lint + name: Lint Java (${{ matrix.profile.name }}) + if: ${{ !inputs.cache-refresh-only && inputs.profiles != 'nightly' }} + runs-on: ubuntu-24.04 + container: + image: amd64/rust + env: + JAVA_TOOL_OPTIONS: '--add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.util.calendar=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED' + strategy: + matrix: + profile: + - name: "Spark 3.4, JDK 17, Scala 2.12" + java_version: "17" + maven_opts: "-Pspark-3.4 -Pscala-2.12" + - name: "Spark 3.5, JDK 17, Scala 2.12" + java_version: "17" + maven_opts: "-Pspark-3.5 -Pscala-2.12" + - name: "Spark 4.0, JDK 17" + java_version: "17" + maven_opts: "-Pspark-4.0" + - name: "Spark 4.0, JDK 21" + java_version: "21" + maven_opts: "-Pspark-4.0" + - name: "Spark 4.1, JDK 17" + java_version: "17" + maven_opts: "-Pspark-4.1" + - name: "Spark 4.2, JDK 17" + java_version: "17" + maven_opts: "-Pspark-4.2" + fail-fast: false + steps: + - uses: actions/checkout@v7 + + - name: Setup Rust & Java toolchain + uses: ./.github/actions/setup-builder + with: + rust-version: ${{ env.RUST_VERSION }} + jdk-version: ${{ matrix.profile.java_version }} + + - name: Restore Maven dependencies + id: maven-cache + uses: actions/cache/restore@v6 + with: + path: | + ~/.m2/repository + /root/.m2/repository + key: ${{ runner.os }}-java-maven-${{ hashFiles('**/pom.xml') }}-lint + restore-keys: | + ${{ runner.os }}-java-maven- + + - name: Run scalafix check + run: | + ./mvnw -B package -DskipTests scalafix:scalafix -Dscalafix.mode=CHECK -Psemanticdb ${{ matrix.profile.maven_opts }} + + - name: Setup Node.js + uses: actions/setup-node@v7 + with: + node-version: '24' + + - name: Install prettier + run: | + npm install -g prettier + + - name: Run prettier + run: | + npx prettier "**/*.md" --write + + - name: Mark workspace as safe for git + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + + - name: Check for any local git changes (such as generated docs) + run: | + ./dev/ci/check-working-tree-clean.sh + + # Saved only on main: an entry written from a pull request or a + # `gh-readonly-queue/*` branch cannot be restored by any later run, and + # it evicts main's from the shared budget. See "Large caches are written + # on main only" in README.md. + - name: Save Maven dependencies + if: ${{ github.ref == 'refs/heads/main' && steps.maven-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@v6 + with: + path: | + ~/.m2/repository + /root/.m2/repository + key: ${{ runner.os }}-java-maven-${{ hashFiles('**/pom.xml') }}-lint + + # Compiles main and test sources with -Pstrict-warnings, which promotes scalac warnings to + # errors, so a change that reintroduces a cleared warning (an Int widened into a Long metric, + # a discarded builder result) fails here rather than accumulating. Spark 3.5 only: the profile + # passes on the Scala 2.12 profiles, and the Scala 2.13 remainder is tracked in + # https://github.com/apache/datafusion-comet/issues/5893. + strict-scala-warnings: + needs: lint + name: Strict Scala warnings (Spark 3.5, JDK 17) + if: ${{ !inputs.cache-refresh-only && inputs.profiles != 'nightly' }} + runs-on: ubuntu-24.04 + container: + image: amd64/rust + steps: + - uses: actions/checkout@v7 + + - name: Setup Rust & Java toolchain + uses: ./.github/actions/setup-builder + with: + rust-version: ${{ env.RUST_VERSION }} + jdk-version: 17 + + - name: Restore Maven dependencies + id: maven-cache + uses: actions/cache/restore@v6 + with: + path: | + ~/.m2/repository + /root/.m2/repository + key: ${{ runner.os }}-java-maven-${{ hashFiles('**/pom.xml') }}-strict-warnings + restore-keys: | + ${{ runner.os }}-java-maven- + + - name: Compile with strict warnings + run: ./mvnw -B test-compile -Pspark-3.5 -Pstrict-warnings -DskipTests Review Comment: `main` has changed three of the moved jobs since this base, and a rebase that keeps this new file will drop the changes. One of them would go unnoticed. https://github.com/apache/datafusion-comet/pull/5365 changed this command to `-Pspark-3.5,delta -Pstrict-warnings` so that Delta contrib compile errors fail on the pull request. Without `delta` here the run still passes and that coverage is gone. In `lint-java`, https://github.com/apache/datafusion-comet/pull/7521 removed the Spark 3.4 row at lines 117-119, and https://github.com/apache/datafusion-comet/pull/6061 wrapped `Run scalafix check` in a loop that retries only on download errors. After the rebase, could you diff each moved job against its current version in `main`'s `pr_build_linux.yml`? ########## .github/workflows/pr_build_linux_checks.yml: ########## @@ -0,0 +1,318 @@ +# 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. + +name: PR Checks (Linux) + +# Independent lint, compilation, compatibility, and Rust debug checks. +# Run alongside the shared native producer; these jobs do not consume its artifact. +# Triggering and path filters live in the umbrella workflow. +on: + workflow_call: + inputs: + cache-refresh-only: + description: 'Skip independent checks on cache-only pushes' + type: boolean + default: false + profiles: + description: 'Linux profile selection; nightly skips checks already run at this commit' + type: string + default: 'all' + +permissions: + contents: read + +env: + RUST_VERSION: stable + RUST_BACKTRACE: 1 + # Force GNU ld on Linux: recent Rust stable defaults to rust-lld on + # x86_64-unknown-linux-gnu, and rust-lld cannot resolve -ljvm against the + # Zulu JDK layout installed by setup-java. Keep bfd for all cargo invocations. + RUSTFLAGS: "-Clink-arg=-fuse-ld=bfd" + +jobs: + lint: + if: ${{ !inputs.cache-refresh-only }} + name: Lint + runs-on: ubuntu-24.04 + container: + image: amd64/rust + steps: + - uses: actions/checkout@v7 + + - name: Check Rust formatting + run: | + rustup component add rustfmt + cd native && cargo fmt --all -- --check Review Comment: https://github.com/apache/datafusion-comet/pull/7299 added `cargo fmt --manifest-path native-executors/Cargo.toml --all -- --check` to `lint` on `main`. It also added a `linux-test-native-executors` job (`needs: lint`) to `pr_build_linux.yml`. That job does not use the native artifact, so leaving it in `pr_build_linux.yml` would make it wait for the shared producer. It belongs here with the other checks, and in `INDEPENDENT_LINUX_JOBS`. Also, `cargo fmt` now runs twice, here and in `build_linux_native.yml` lines 46-47. If only one of the two gets the `native-executors` check, they will drift apart. Could one of them be dropped? ########## dev/ci/compute-changes.py: ########## @@ -579,6 +593,25 @@ "iceberg_1_11": ["queue", "label:run-iceberg-tests"], } +# Map each caller job that downloads the shared Linux native library to every +# output key that can select it. Insertion order follows the callers in ci.yml. +# Linux has separate default/all-profile routes, and Spark 4.1 has core/Hive +# routes; either route must select the shared producer for its caller. +# The producer has no independent path or event policy: it runs exactly when +# any route of at least one consumer is selected after FILTERS and POLICY apply. +NATIVE_CONSUMERS = { + "pr_build_linux": ("build_linux", "build_linux_all_profiles"), + "spark_3_4": ("spark_3_4",), + "spark_3_5": ("spark_3_5",), + "spark_4_0": ("spark_4_0",), + "spark_4_1": ("spark_4_1", "spark_4_1_hive"), + "spark_4_2": ("spark_4_2",), + "iceberg_1_8": ("iceberg_1_8",), + "iceberg_1_9": ("iceberg_1_9",), + "iceberg_1_10": ("iceberg_1_10",), + "iceberg_1_11": ("iceberg_1_11",), +} Review Comment: After the rebase, `spark_3_4` and `iceberg_1_8` have to come out of this table, since https://github.com/apache/datafusion-comet/pull/7521 removed them from `POLICY`. Separately, `main` now has three more callers of the same library: `delta_3_5`, `delta_4_0` and `delta_4_1` call `delta_contrib_test.yml`. Both of its jobs run `cargo build --profile ci` in `native` with the same `RUSTFLAGS`, and its comment says `delta` is a default feature. `SHARED_NATIVE_CONSUMERS` in `check-ci-config.py` is a fixed set, so nothing will report them. Could they consume `native-lib-linux` too, or could the description say why they are out of scope? ########## .github/workflows/build_linux_native.yml: ########## @@ -0,0 +1,86 @@ +# 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. + +# Single producer for the default Linux CI native library. The umbrella runs +# this whenever any Linux, Spark SQL, or Iceberg test consumer is selected. +name: Build Linux Native Library + +on: + workflow_call: + +permissions: + contents: read + +env: + RUST_VERSION: stable + RUST_BACKTRACE: 1 + +jobs: + build-native: + name: Build Native Library + runs-on: ubuntu-24.04 + container: + image: amd64/rust + steps: + - uses: actions/checkout@v7 + - name: Setup Rust toolchain + uses: ./.github/actions/setup-builder + with: + rust-version: ${{ env.RUST_VERSION }} + jdk-version: 17 # JDK only needed for JVM module proto generation + + - name: Check Rust formatting + run: cd native && cargo fmt --all -- --check + + - name: Restore Cargo cache + id: cargo-cache + uses: actions/cache/restore@v6 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + native/target + key: ${{ runner.os }}-cargo-ci-${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }} + + - name: Build native library (CI profile) + run: | + cd native + # CI profile: same overflow behavior as release, but faster compilation + # (no LTO, parallel codegen) + cargo build --profile ci + env: + RUSTFLAGS: "-Ctarget-cpu=x86-64-v3 -Clink-arg=-fuse-ld=bfd" + + - name: Upload native library + uses: ./.github/actions/upload-artifact-retry + with: + name: native-lib-linux + path: native/target/ci/libcomet.so + retention-days: 1 Review Comment: On `main`, `build-native` uploads `native/target/ci/libcomet_test_udfs.so` next to `libcomet.so` (https://github.com/apache/datafusion-comet/pull/4459). `CometNativeUdfSuite` in the `linux-test` expressions shard needs it, and fails when `CI` is set and the file is missing. So this would show up as a test failure, but the producer needs the multi-line `path` from `main`. ########## dev/ci/test-ci-config.py: ########## @@ -0,0 +1,573 @@ +# 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. + +"""Regression tests for shared artifacts using mutations of the real workflows.""" + +import importlib.util +import re +from pathlib import Path +import shutil +import tempfile +import unittest +from unittest import mock + + +SPEC = importlib.util.spec_from_file_location( + "check_ci_config", Path(__file__).with_name("check-ci-config.py")) +CHECK = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(CHECK) +WORKFLOWS = Path(__file__).resolve().parents[2] / ".github/workflows" + +# Pin every direct Maven caller affected by splitting the Linux workflow. +MAVEN_JOBS = { + "pr_build_linux_checks.yml": ( + "lint-java", "strict-scala-warnings", "celeborn-reflection-compatibility"), + "pr_build_linux.yml": ("verify-benchmark-results-tpch", "verify-benchmark-results-tpcds"), + "spark_sql_test_reusable.yml": ("build",), +} + + +class SharedNativeArtifactTest(unittest.TestCase): + def setUp(self): + self.temp = tempfile.TemporaryDirectory(prefix="comet-ci-config-test-") + self.addCleanup(self.temp.cleanup) + self.workflows = Path(self.temp.name) / "workflows" + shutil.copytree(WORKFLOWS, self.workflows) + + def replace(self, filename, old, new): + path = self.workflows / filename + text = path.read_text(encoding="utf-8") + self.assertIn(old, text, f"Fixture changed: {filename}") + path.write_text(text.replace(old, new, 1), encoding="utf-8") Review Comment: Most of the PR's added lines come from these two new test files (1,058 lines), compared with about 100 lines of new workflow YAML. `replace` asserts that exact workflow text is present, so any unrelated edit to the quoted lines in `ci.yml`, `pr_build_linux.yml` or `spark_sql_test_reusable.yml` fails with `Fixture changed`. Line 127 does this even for the macOS caller. In `test-native-build-selection.py`, `test_producer_output_matches_all_consumer_combinations` runs through 2,048 masks to re-check a one-line `any()`. `check-ci-config.py` already has `ROUTING_CASES` and `POLICY_CASES` tables that run in preflight. A handful of rows there (Hive-only label, all-profiles label, push, a native-only path) would cover the same routing, and both files could be dropped. That would also leave less to resolve against the 571 lines added and 104 removed in `check-ci-config.py` on `main` since this base. ########## .github/workflows/spark_sql_test_reusable.yml: ########## @@ -24,6 +24,10 @@ name: Spark SQL Tests (reusable) on: workflow_call: inputs: + native-library-artifact: + description: 'Default Linux CI library produced by the calling workflow' + required: true + type: string Review Comment: `shared_native_failures` requires every caller to pass exactly `native-lib-linux`, and the producer to upload only that name, so this input always has the same value. The dependency itself is already expressed and checked through `needs: [changes, build_linux_native]`. Hardcoding `native-lib-linux` in the download steps, as `linux-test` already did on the base, would remove this input from three workflows and ten `with:` lines in `ci.yml`. It would also remove the guard code and about six mutation tests that pin the input. The cost is a missing producer failing at the download step instead of at workflow validation. Is that difference worth the extra code? -- 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]
