Skip to content

Commit 3572526

Browse files
Revert "Revert "chore[ci]: add windows test to CI (#5439)"" (#5486)
Reverts #5449 --------- Signed-off-by: Joe Isaacs <[email protected]>
1 parent b12f7a3 commit 3572526

File tree

7 files changed

+98
-20
lines changed

7 files changed

+98
-20
lines changed

.github/actions/setup-rust/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ runs:
2525
run: echo "version=$(cat rust-toolchain.toml | grep channel | awk -F'\"' '{print $2}')" >> $GITHUB_OUTPUT
2626

2727
- name: Install Mold
28+
if: runner.os == 'Linux'
2829
uses: rui314/setup-mold@v1
2930

3031
- name: Rust Toolchain
@@ -50,6 +51,7 @@ runs:
5051
run: echo "PATH=$PATH" >> $GITHUB_ENV
5152

5253
- name: Install Protoc (for lance-encoding build step)
54+
if: runner.os != 'Windows'
5355
uses: arduino/setup-protoc@v3
5456
with:
5557
version: "29.3"

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,59 @@ jobs:
400400
--target x86_64-unknown-linux-gnu \
401401
--verbose
402402
403+
rust-test-other:
404+
name: "Rust tests (${{ matrix.os }})"
405+
timeout-minutes: 120
406+
strategy:
407+
fail-fast: false
408+
matrix:
409+
include:
410+
- os: windows-x64
411+
runner:
412+
- runs-on=${{ github.run_id }}
413+
- family=m7i
414+
- cpu=8
415+
- image=windows22-full-x64
416+
- tag=rust-test-windows
417+
- os: linux-arm64
418+
runner:
419+
- runs-on=${{ github.run_id }}
420+
- family=m7g
421+
- cpu=8
422+
- image=ubuntu24-full-arm64
423+
- extras=s3-cache
424+
- tag=rust-test-linux-arm64
425+
runs-on: ${{ matrix.runner }}
426+
steps:
427+
- uses: runs-on/action@v2
428+
if: matrix.os == 'linux-arm64'
429+
with:
430+
sccache: s3
431+
- uses: actions/checkout@v5
432+
- name: Install Visual Studio Build Tools (Windows)
433+
if: matrix.os == 'windows-x64'
434+
shell: bash
435+
run: |
436+
choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --passive" -y
437+
- name: Setup Python (Windows)
438+
if: matrix.os == 'windows-x64'
439+
uses: actions/setup-python@v5
440+
with:
441+
python-version: "3.11"
442+
- uses: ./.github/actions/setup-rust
443+
with:
444+
repo-token: ${{ secrets.GITHUB_TOKEN }}
445+
- name: Install nextest
446+
uses: taiki-e/install-action@v2
447+
with:
448+
tool: nextest
449+
- name: Rust Tests (Windows)
450+
if: matrix.os == 'windows-x64'
451+
run: cargo nextest run --locked --workspace --all-features --no-fail-fast --exclude bench-vortex --exclude vortex-python --exclude vortex-duckdb --exclude vortex-fuzz
452+
- name: Rust Tests (Other)
453+
if: matrix.os != 'windows-x64'
454+
run: cargo nextest run --locked --workspace --all-features --no-fail-fast --exclude bench-vortex --exclude vortex-duckdb
455+
403456
build-java:
404457
name: "Java"
405458
runs-on: ubuntu-latest

vortex-ffi/src/file.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,29 @@ impl vx_file_scan_options {
122122
self.filter_expression_len,
123123
)?;
124124

125+
// On Windows, c_ulong is u32, so we need to convert to u64
126+
// On Unix, c_ulong is already u64, so we can use it directly
127+
#[cfg(windows)]
128+
let row_range = (self.row_range_end > self.row_range_start)
129+
.then_some(self.row_range_start as u64..self.row_range_end as u64);
130+
#[cfg(not(windows))]
125131
let row_range = (self.row_range_end > self.row_range_start)
126132
.then_some(self.row_range_start..self.row_range_end);
127133

128134
let split_by = (self.split_by_row_count > 0)
129135
.then_some(SplitBy::RowCount(self.split_by_row_count as usize));
130136

137+
#[cfg(windows)]
138+
let row_offset = self.row_offset as u64;
139+
#[cfg(not(windows))]
140+
let row_offset = self.row_offset;
141+
131142
Ok(ScanOptions {
132143
projection_expr,
133144
filter_expr,
134145
split_by,
135146
row_range,
136-
row_offset: self.row_offset,
147+
row_offset,
137148
})
138149
}
139150
}

vortex-io/src/file/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mod driver;
77
pub mod object_store;
88
mod read;
99
#[cfg(not(target_arch = "wasm32"))]
10-
mod std_file;
10+
pub(crate) mod std_file;
1111

1212
pub(crate) use driver::*;
1313
pub use read::*;

vortex-io/src/file/object_store.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
use std::io;
5-
#[cfg(unix)]
6-
use std::os::unix::fs::FileExt;
75
use std::sync::Arc;
86

97
use async_compat::Compat;
@@ -16,6 +14,8 @@ use vortex_error::{VortexError, VortexResult, vortex_ensure};
1614

1715
use crate::file::IoRequest;
1816
use crate::file::read::{CoalesceWindow, IntoReadSource, ReadSource, ReadSourceRef};
17+
#[cfg(not(target_arch = "wasm32"))]
18+
use crate::file::std_file::read_exact_at;
1919
use crate::runtime::Handle;
2020

2121
const COALESCING_WINDOW: CoalesceWindow = CoalesceWindow {
@@ -134,15 +134,8 @@ impl ReadSource for ObjectStoreIoSource {
134134

135135
handle
136136
.spawn_blocking(move || {
137-
#[cfg(unix)] {
138-
file.read_exact_at(&mut buffer, range.start)?;
139-
Ok::<_, io::Error>(buffer)
140-
}
141-
#[cfg(not(unix))] {
142-
file.seek(range.start)?;
143-
file.read_exact(&mut buffer)?;
144-
Ok::<_, io::Error>(buffer)
145-
}
137+
read_exact_at(&file, &mut buffer, range.start)?;
138+
Ok::<_, io::Error>(buffer)
146139
})
147140
.await
148141
.map_err(io::Error::other)?

vortex-io/src/file/std_file.rs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
use std::fs::File;
5+
#[cfg(not(unix))]
6+
use std::io::{Read, Seek};
7+
#[cfg(unix)]
58
use std::os::unix::fs::FileExt;
9+
#[cfg(windows)]
10+
use std::os::windows::fs::FileExt;
611
use std::path::{Path, PathBuf};
712
use std::sync::Arc;
813

@@ -15,6 +20,23 @@ use vortex_error::{VortexError, VortexResult};
1520
use crate::file::{CoalesceWindow, IntoReadSource, IoRequest, ReadSource, ReadSourceRef};
1621
use crate::runtime::Handle;
1722

23+
/// Read exactly `buffer.len()` bytes from `file` starting at `offset`.
24+
/// This is a platform-specific helper that uses the most efficient method available.
25+
#[cfg(not(target_arch = "wasm32"))]
26+
pub(crate) fn read_exact_at(file: &File, buffer: &mut [u8], offset: u64) -> std::io::Result<()> {
27+
#[cfg(unix)]
28+
{
29+
file.read_exact_at(buffer, offset)
30+
}
31+
#[cfg(not(unix))]
32+
{
33+
use std::io::SeekFrom;
34+
let mut file_ref = file;
35+
file_ref.seek(SeekFrom::Start(offset))?;
36+
file_ref.read_exact(buffer)
37+
}
38+
}
39+
1840
const COALESCING_WINDOW: CoalesceWindow = CoalesceWindow {
1941
// TODO(ngates): these numbers don't make sense if we're using spawn_blocking..
2042
distance: 8 * 1024, // KB
@@ -83,12 +105,7 @@ impl ReadSource for FileIoSource {
83105
let mut buffer = ByteBufferMut::with_capacity_aligned(len, req.alignment());
84106
unsafe { buffer.set_len(len) };
85107

86-
#[cfg(unix)]
87-
let buffer_res = file.read_exact_at(&mut buffer, offset);
88-
#[cfg(not(unix))]
89-
let buffer_res = file
90-
.seek(io::SeekFrom::Start(offset))
91-
.and_then(|_| file.read_exact(&mut buffer));
108+
let buffer_res = read_exact_at(&file, &mut buffer, offset);
92109

93110
req.resolve(
94111
buffer_res

vortex-io/src/runtime/tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,18 +326,20 @@ async fn test_task_detach() {
326326
let handle = TokioRuntime::current();
327327
let counter = Arc::new(AtomicUsize::new(0));
328328
let c = counter.clone();
329+
let (tx, rx) = oneshot::channel::<()>();
329330

330331
let task = handle.spawn(async move {
331332
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
332333
c.fetch_add(1, Ordering::SeqCst);
333-
42
334+
tx.send(())
334335
});
335336

336337
// Detach the task so it continues running
337338
task.detach();
338339

339340
// Wait for task to complete
340341
tokio::time::sleep(std::time::Duration::from_millis(20)).await;
342+
let _ = rx.await;
341343

342344
// Task should have completed even though we detached it
343345
assert_eq!(counter.load(Ordering::SeqCst), 1);

0 commit comments

Comments
 (0)