Skip to content

Commit e021e20

Browse files
authored
Merge branch 'main' into centralize-float-canonicalization
2 parents e76a2ba + 2bb383e commit e021e20

244 files changed

Lines changed: 17419 additions & 7348 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.ai/skills/datafusion-ffi/SKILL.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,21 +197,21 @@ Templates: `test_ffi_table_provider_local_bypass` and `test_round_trip_ffi_table
197197

198198
What unit tests catch: Rust-level correctness (translation logic, lifetime bugs, leaks under valgrind/miri, Send/Sync, error propagation, codec round-trips). What they **cannot** catch: real ABI bugs. Both producer and consumer share `#[repr(C)]` layout because they are the exact same struct definition in memory.
199199

200-
#### b. Cross-library integration tests (`tests/ffi_*.rs`, gated by the `integration-tests` feature)
200+
#### b. Cross-library integration tests (`integration-tests/tests/`, gated by the `integration-tests` feature)
201201

202-
The crate is published as `crate-type = ["cdylib", "rlib"]`. The integration tests in `datafusion/ffi/tests/` use `libloading` to `dlopen` the crate's own `cdylib` and call `datafusion_ffi_get_module` — a `#[unsafe(no_mangle)] extern "C"` entry point defined in `src/tests/mod.rs` and gated by `#[cfg(feature = "integration-tests")]`. The test executable links against the rlib (consumer side); the dlopen'd cdylib is the producer side. Even though both are built from the same source, they are independent compilation outputs going through the actual FFI symbol path.
202+
The integration tests live in the unpublished `datafusion-ffi-integration-tests` crate in `datafusion/ffi/integration-tests/`, so that `datafusion-ffi` itself is a plain rlib. That crate is built as a `cdylib` that exports `datafusion_ffi_get_module` — a `#[unsafe(no_mangle)] extern "C"` entry point defined in `src/tests/mod.rs` and gated by `#[cfg(feature = "integration-tests")]`. Its tests use `libloading` to `dlopen` that `cdylib`. The test executable links against the `datafusion-ffi` rlib (consumer side); the dlopen'd cdylib is the producer side. Even though both are built from the same source, they are independent compilation outputs going through the actual FFI symbol path.
203203

204204
Run with:
205205

206206
```bash
207-
cargo test -p datafusion-ffi --features integration-tests
207+
cargo test -p datafusion-ffi -p datafusion-ffi-integration-tests --features integration-tests
208208
```
209209

210210
To add coverage for a new wrapper:
211211

212212
1. **Add a constructor** in `src/tests/<area>.rs` (or a new file there). Return a populated `FFI_X` from a known-good native type.
213213
2. **Wire it into `ForeignLibraryModule`** in `src/tests/mod.rs`: add a field of type `extern "C" fn(...) -> FFI_X` and populate it in `datafusion_ffi_get_module`. This struct is the cross-library contract. Adding a field is itself an ABI change for the test module; integration tests will rebuild the cdylib automatically.
214-
3. **Add the test** in `tests/ffi_<area>.rs` under `#[cfg(feature = "integration-tests")] mod tests { … }`. Call `datafusion_ffi::tests::utils::get_module()` to load the cdylib, invoke your constructor through the returned `ForeignLibraryModule`, convert into `Arc<dyn X>`, and exercise every method.
214+
3. **Add the test** in `integration-tests/tests/cases/<area>.rs`, registered in `cases/mod.rs`, under `mod tests { … }`. Call `datafusion_ffi::tests::utils::get_module()` to load the cdylib, invoke your constructor through the returned `ForeignLibraryModule`, convert into `Arc<dyn X>`, and exercise every method.
215215

216216
When adding a method to an existing wrapper, reuse an existing fixture and constructor when a small trait-method override can cover it. This applies both to omitted default methods and methods newly added to the trait. Add a dedicated test type or `ForeignLibraryModule` field only when the existing fixtures cannot cover the method.
217217

@@ -347,7 +347,7 @@ When reviewing a PR that touches `datafusion/ffi/`:
347347
7. **Stabby types** for strings/vecs; crate-local `FFI_Option`/`FFI_Result` for optional/fallible payloads?
348348
8. **Async** uses `FfiFuture` + `.into_ffi()`, never blocking?
349349
9. **Codec** present on any method that ships an `Expr` / plan?
350-
10. **Unit tests** include both local-bypass and `mock_foreign_marker_id` forced-foreign cases? **Integration tests** in `tests/ffi_*.rs` exist for any wrapper that takes/returns non-trivial FFI types, and for *every* layout change? `cargo test -p datafusion-ffi --features integration-tests` must pass before merging an ABI-affecting PR.
350+
10. **Unit tests** include both local-bypass and `mock_foreign_marker_id` forced-foreign cases? **Integration tests** in `integration-tests/tests/` exist for any wrapper that takes/returns non-trivial FFI types, and for *every* layout change? `cargo test -p datafusion-ffi -p datafusion-ffi-integration-tests --features integration-tests` must pass before merging an ABI-affecting PR.
351351
11. **No `datafusion` runtime dep** crept into `Cargo.toml`?
352352
12. **`Arc::clone(&x)`** everywhere — no implicit `x.clone()` on `Arc` (the lint will reject it but worth pre-flagging).
353353
13. **`cargo clippy --all-targets --all-features -- -D warnings`** clean on the crate?

‎.asf.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ github:
6969
- "cargo check datafusion-spark features"
7070
- "cargo test (amd64)"
7171
- "cargo test 'extended_tests' (amd64)"
72+
- "microbenchmark tests (amd64)"
7273
- "cargo test hash collisions (amd64)"
7374
- "cargo test datafusion-cli (amd64)"
7475
- "cargo examples (amd64)"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Install rustup
19+
description: 'Install rustup and the toolchain from rust-toolchain.toml on a runner without Rust, such as ubuntu-slim'
20+
runs:
21+
using: "composite"
22+
steps:
23+
- name: Install rustup and the toolchain
24+
shell: bash
25+
run: |
26+
RETRY=("ci/scripts/retry" timeout 120)
27+
"${RETRY[@]}" curl -sSf -o "$RUNNER_TEMP/rustup-init.sh" https://sh.rustup.rs
28+
sh "$RUNNER_TEMP/rustup-init.sh" -y --no-modify-path --profile minimal --default-toolchain none
29+
CARGO_BIN="${CARGO_HOME:-$HOME/.cargo}/bin"
30+
export PATH="$CARGO_BIN:$PATH"
31+
echo "$CARGO_BIN" >> "$GITHUB_PATH"
32+
# With no toolchain argument, rustup installs the toolchain and the
33+
# components that rust-toolchain.toml names.
34+
"${RETRY[@]}" rustup toolchain install
35+
- name: Configure rust runtime env
36+
uses: ./.github/actions/setup-rust-runtime

‎.github/dependabot.yml‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ updates:
6262
update-types:
6363
- "minor"
6464
- "patch"
65-
# dev/depcheck is a standalone crate excluded from the workspace, so it is
66-
# not covered by the workspace entry above
67-
- package-ecosystem: cargo
68-
directory: "/dev/depcheck"
69-
schedule:
70-
interval: weekly
71-
target-branch: main
72-
labels: [auto-dependencies]
7365
# the wasm test app has its own npm lockfile
7466
- package-ecosystem: npm
7567
directory: "/datafusion/wasmtest/datafusion-wasm-app"

‎.github/pull_request_template.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
> [!IMPORTANT]
2+
>
3+
> **Fork CI setup:** For pull requests from a fork to `main`, enable workflows in your fork's **Actions** tab before you push.
4+
> See the [fork CI setup guide](https://datafusion.apache.org/contributor-guide/#pull-requests-from-forks).
5+
16
## Which issue does this PR close?
27

38
<!--
@@ -10,7 +15,7 @@ We generally require a GitHub issue to be filed for all bug fixes and enhancemen
1015

1116
<!--
1217
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
13-
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
18+
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
1419
1520
Please explain the problem you are trying to solve in terms of the user-visible
1621
behavior, rather than the implementation.

‎.github/workflows/audit.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ permissions:
4141

4242
jobs:
4343
security_audit:
44-
runs-on: ubuntu-latest
44+
runs-on: ubuntu-slim
4545
steps:
4646
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
47+
- name: Setup Rust toolchain
48+
uses: ./.github/actions/setup-rustup
4749
- name: Install cargo-audit
48-
uses: taiki-e/install-action@ab6895351a88b908e96a4697860d4ffea5e57dbe # v2.87.27
50+
uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29
4951
with:
5052
tool: cargo-audit
5153
- name: Run audit check

‎.github/workflows/breaking_changes_detector.yml‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
# Detect semver-incompatible (breaking) API changes in crates modified by a PR.
1919
#
2020
# Only public workspace crates that have file changes are checked.
21-
# Internal crates (benchmarks, test-utils, sqllogictest, doc) are excluded.
21+
# Crates with `publish = false` (such as benchmarks and test-utils) and
22+
# datafusion-sqllogictest are excluded.
2223
#
2324
# This workflow only runs cargo-semver-checks and uploads the result as an
2425
# artifact. The actual PR comment is posted by a companion workflow
@@ -78,18 +79,17 @@ jobs:
7879
echo "packages=$PACKAGES" >> "$GITHUB_OUTPUT"
7980
echo "Changed crates: $PACKAGES"
8081
81-
# `datafusion-substrait` (and crates that depend on it via sqllogictest)
82-
# have a build script that calls protoc, which is not preinstalled on
83-
# ubuntu-latest runners.
84-
- name: Install Protobuf Compiler
82+
# The `substrait` crate's build script runs protoc, which is not
83+
# preinstalled on ubuntu-latest runners.
84+
- name: Install protoc
8585
if: steps.changed_crates.outputs.packages != ''
86-
run: |
87-
sudo apt-get update
88-
sudo apt-get install -y protobuf-compiler
86+
uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29
87+
with:
88+
tool: protoc@3.21.12
8989

9090
- name: Install cargo-semver-checks
9191
if: steps.changed_crates.outputs.packages != ''
92-
uses: taiki-e/install-action@ab6895351a88b908e96a4697860d4ffea5e57dbe # v2.87.27
92+
uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29
9393
with:
9494
tool: cargo-semver-checks
9595

‎.github/workflows/breaking_changes_detector_comment.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
comment-on-pr:
6262
name: Comment on pull request
6363
if: github.event.workflow_run.event == 'pull_request'
64-
runs-on: ubuntu-latest
64+
runs-on: ubuntu-slim
6565
# Scoped to the minimum needed to upsert/delete the sticky comment.
6666
permissions:
6767
actions: read

‎.github/workflows/codeql.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ jobs:
4545
persist-credentials: false
4646

4747
- name: Initialize CodeQL
48-
uses: github/codeql-action/init@24c54180a607b1449ed407dd24f251e4e9147c8d # v4
48+
uses: github/codeql-action/init@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4
4949
with:
5050
languages: actions
5151

5252
- name: Perform CodeQL Analysis
53-
uses: github/codeql-action/analyze@24c54180a607b1449ed407dd24f251e4e9147c8d # v4
53+
uses: github/codeql-action/analyze@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4
5454
with:
5555
category: "/language:actions"

‎.github/workflows/dependencies.yml‎

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,36 +40,19 @@ permissions:
4040
contents: read
4141

4242
jobs:
43-
depcheck:
44-
name: Circular Dependency Check
45-
runs-on: ubuntu-latest
46-
container:
47-
image: amd64/rust
48-
steps:
49-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
50-
with:
51-
submodules: true
52-
fetch-depth: 1
53-
- name: Setup Rust toolchain
54-
uses: ./.github/actions/setup-builder
55-
with:
56-
rust-version: stable
57-
- name: Check dependencies
58-
run: bash ci/scripts/check_circular_dependencies.sh
59-
6043
detect-unused-dependencies:
6144
name: Detect Unused Dependencies
62-
runs-on: ubuntu-latest
63-
container:
64-
image: amd64/rust
45+
runs-on: ubuntu-slim
6546
steps:
6647
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
48+
- name: Setup Rust toolchain
49+
uses: ./.github/actions/setup-rustup
6750
- name: Load tool versions
6851
run: |
6952
. ci/scripts/utils/tool_versions.sh
7053
echo "CARGO_MACHETE_VERSION=${CARGO_MACHETE_VERSION}" >> "$GITHUB_ENV"
7154
- name: Install cargo-machete
72-
uses: taiki-e/install-action@ab6895351a88b908e96a4697860d4ffea5e57dbe # v2.87.27
55+
uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29
7356
with:
7457
tool: cargo-machete@${{ env.CARGO_MACHETE_VERSION }}
7558
- name: Detect unused dependencies

0 commit comments

Comments
 (0)