diff --git a/bench-orchestrator/bench_orchestrator/ci_matrix/catalog.py b/bench-orchestrator/bench_orchestrator/ci_matrix/catalog.py index e905cd85c91..a28b2a373c8 100644 --- a/bench-orchestrator/bench_orchestrator/ci_matrix/catalog.py +++ b/bench-orchestrator/bench_orchestrator/ci_matrix/catalog.py @@ -70,7 +70,7 @@ # Vortex targets name an integration (`file`, `datasource`) and a scan engine (`v1`, `v2`); see # `BenchmarkTarget`. Declared targets run the file integration on the suite's default engine. # `ScanCoverage.ALL` adds every other valid combination for the `vortex` format: DataFusion file-v1 and -# datasource-v1 beside file-v2, and DuckDB file-v1 beside file-v2, on V2 suites. Each combination runs +# datasource-v2 and datasource-v1 beside file-v2, and DuckDB file-v1 beside file-v2, on V2 suites. Each combination runs # as a matrix entry, and so a machine, of its own, so covering them all adds machines, not wall time. @@ -108,6 +108,10 @@ def with_all_scans(coverage: Coverage) -> Coverage: BenchmarkTarget(Engine.DATAFUSION, Format.VORTEX, Integration.FILE, ScanEngine.V1), "DataFusion, Vortex, file v1", ), + ( + BenchmarkTarget(Engine.DATAFUSION, Format.VORTEX, Integration.DATASOURCE, ScanEngine.V2), + "DataFusion, Vortex, datasource v2", + ), ( BenchmarkTarget(Engine.DATAFUSION, Format.VORTEX, Integration.DATASOURCE, ScanEngine.V1), "DataFusion, Vortex, datasource v1", diff --git a/bench-orchestrator/bench_orchestrator/config.py b/bench-orchestrator/bench_orchestrator/config.py index 7be6cff9e29..38a4ce09e10 100644 --- a/bench-orchestrator/bench_orchestrator/config.py +++ b/bench-orchestrator/bench_orchestrator/config.py @@ -132,9 +132,7 @@ class Benchmark(Enum): SUPPORTED_SCANS: dict[Engine, dict[Integration, frozenset[ScanEngine]]] = { Engine.DATAFUSION: { Integration.FILE: frozenset({ScanEngine.V1, ScanEngine.V2}), - # `VortexTable` reaches only V1: `MultiFileDataSource` opens `LayoutReader`s. V2 needs the V2 - # scan behind `split`/`open` (#11626). - Integration.DATASOURCE: frozenset({ScanEngine.V1}), + Integration.DATASOURCE: frozenset({ScanEngine.V1, ScanEngine.V2}), }, Engine.DUCKDB: { Integration.FILE: frozenset({ScanEngine.V1, ScanEngine.V2}), @@ -168,11 +166,6 @@ def scan_support_error(engine: Engine, integration: Integration, scan: ScanEngin return "duckdb has no DataSource table function yet, so it has no datasource targets" return f"{engine.value} has no {integration.value} integration" if scan is not None and scan not in integrations[integration]: - if engine is Engine.DATAFUSION and integration is Integration.DATASOURCE and scan is ScanEngine.V2: - return ( - "datafusion datasource targets run only the v1 scan: MultiFileDataSource opens " - "LayoutReaders, and v2 needs the V2 scan behind split/open (#11626)" - ) return f"{engine.value} {integration.value} targets cannot run the {scan.value} scan" return None diff --git a/bench-orchestrator/tests/test_config.py b/bench-orchestrator/tests/test_config.py index f73b8bffaf7..68fa7c33094 100644 --- a/bench-orchestrator/tests/test_config.py +++ b/bench-orchestrator/tests/test_config.py @@ -202,9 +202,9 @@ def test_parse_targets_json_rejects_unknown_axes() -> None: (Engine.DATAFUSION, Integration.FILE, ScanEngine.V1, None), (Engine.DATAFUSION, Integration.FILE, ScanEngine.V2, None), (Engine.DATAFUSION, Integration.DATASOURCE, ScanEngine.V1, None), + (Engine.DATAFUSION, Integration.DATASOURCE, ScanEngine.V2, None), (Engine.DUCKDB, Integration.FILE, ScanEngine.V1, None), (Engine.DUCKDB, Integration.FILE, ScanEngine.V2, None), - (Engine.DATAFUSION, Integration.DATASOURCE, ScanEngine.V2, "datasource targets run only the v1 scan"), (Engine.DUCKDB, Integration.DATASOURCE, ScanEngine.V1, "duckdb has no DataSource table function yet"), (Engine.DUCKDB, Integration.DATASOURCE, ScanEngine.V2, "duckdb has no DataSource table function yet"), ], diff --git a/bench-orchestrator/tests/test_matrix.py b/bench-orchestrator/tests/test_matrix.py index 67abe1b8812..a96f0a487c2 100644 --- a/bench-orchestrator/tests/test_matrix.py +++ b/bench-orchestrator/tests/test_matrix.py @@ -75,6 +75,7 @@ "duckdb-parquet", "duckdb-vortex", "datafusion-vortex-file-v1", + "datafusion-vortex-datasource-v2", "datafusion-vortex-datasource-v1", "duckdb-vortex-file-v1", ) @@ -83,7 +84,7 @@ "tpch-nested-s3", ), } -SCAN_SUFFIXES = ("datafusion-file-v1", "datafusion-datasource-v1", "duckdb-file-v1") +SCAN_SUFFIXES = ("datafusion-file-v1", "datafusion-datasource-v2", "datafusion-datasource-v1", "duckdb-file-v1") def _entries(preset: str) -> list[dict[str, object]]: @@ -121,6 +122,7 @@ def _group_targets(preset: str) -> dict[str, set[tuple[str, str]]]: ("datafusion", "parquet"), ("datafusion", "vortex [file, v2]"), ("datafusion", "vortex [file, v1]"), + ("datafusion", "vortex [datasource, v2]"), ("datafusion", "vortex [datasource, v1]"), ("duckdb", "parquet"), ("duckdb", "vortex [file, v2]"), @@ -197,11 +199,11 @@ def test_tpcds_sf100_runs_one_target_per_job() -> None: entry for entry in _entries("nightly") if str(entry["id"]).startswith("tpcds-") and "-100-" in str(entry["id"]) ] - assert len(nightly) == 14 + assert len(nightly) == 16 assert all(len(_targets(entry)) == 1 for entry in nightly) assert {target for entry in nightly for target in _targets(entry)} == ALL_SCANS s3_keys = [entry["remote_key"] for entry in nightly if "remote_key" in entry] - assert len(s3_keys) == len(set(s3_keys)) == 7 + assert len(s3_keys) == len(set(s3_keys)) == 8 def test_nightly_runs_every_scan() -> None: @@ -251,6 +253,8 @@ def test_nightly_runs_every_valid_scan() -> None: ) if not benchmark_id.startswith("tpch-nested"): expected |= {(engine, "vortex [file, v2]") for engine in engines} + if "datafusion" in engines: + expected.add(("datafusion", "vortex [datasource, v2]")) assert scans == expected, benchmark_id diff --git a/benchmarks/datafusion-bench/src/main.rs b/benchmarks/datafusion-bench/src/main.rs index d5d6d328513..9b140a6ed86 100644 --- a/benchmarks/datafusion-bench/src/main.rs +++ b/benchmarks/datafusion-bench/src/main.rs @@ -30,7 +30,6 @@ use vortex::file::multi::MultiFileDataSource; use vortex::io::filesystem::FileSystemRef; use vortex::io::object_store::ObjectStoreFileSystem; use vortex::io::session::RuntimeSessionExt; -use vortex::scan::DataSource as _; use vortex::scan::DataSourceRef; use vortex_arrow::ArrowSessionExt; use vortex_bench::Benchmark; @@ -125,8 +124,7 @@ struct Args { scan_v1: bool, /// Register Vortex tables through the Scan API (`VortexTable` over a `MultiFileDataSource`) - /// instead of a listing table, whatever `--scan-v1` says. `MultiFileDataSource` runs the V1 - /// scan. + /// instead of a listing table. `--scan-v1` still picks the scan the tables run on. #[arg(long, default_value_t = false, action = clap::ArgAction::Set)] scan_api: bool, @@ -268,7 +266,7 @@ async fn register_benchmark_tables( scan_api: bool, ) -> anyhow::Result<()> { if scan_api && matches!(format, Format::OnDiskVortex | Format::VortexCompact) { - register_v2_tables(session, benchmark, format).await + register_scan_api_tables(session, benchmark, format, scan_v2).await } else { let benchmark_base = benchmark.data_url().join(&format!("{}/", format.name()))?; let file_format = format_to_df_format(format, scan_v2)?; @@ -304,11 +302,16 @@ async fn register_benchmark_tables( } } -/// Register tables using the Scan API path: a `VortexTable` over a `MultiFileDataSource`. -async fn register_v2_tables( +/// Register tables through the Scan API: a `VortexTable` over a `MultiFileDataSource`. +/// +/// With `scan_v2`, the table scans its files on the planner-driven scan through +/// [`MultiFileDataSource::build_plan`], whose files open as the scan reaches them. Otherwise it +/// scans them on layout readers through [`MultiFileDataSource::build`]. +async fn register_scan_api_tables( session: &SessionContext, benchmark: &B, format: Format, + scan_v2: bool, ) -> anyhow::Result<()> { let benchmark_base = benchmark.data_url().join(&format!("{}/", format.name()))?; @@ -332,13 +335,14 @@ async fn register_v2_tables( None => format!("*.{}", format.ext()), }; - let multi_ds = MultiFileDataSource::new(SESSION.clone()) - .with_glob(glob_pattern, Some(fs)) - .build() - .await?; + let builder = MultiFileDataSource::new(SESSION.clone()).with_glob(glob_pattern, Some(fs)); + let data_source: DataSourceRef = if scan_v2 { + builder.build_plan().await? + } else { + Arc::new(builder.build().await?) + }; - let arrow_schema = Arc::new(SESSION.arrow().to_arrow_schema(multi_ds.dtype())?); - let data_source: DataSourceRef = Arc::new(multi_ds); + let arrow_schema = Arc::new(SESSION.arrow().to_arrow_schema(data_source.dtype())?); let table_provider = Arc::new(VortexTable::new(data_source, SESSION.clone(), arrow_schema)); session.register_table(table.name, table_provider)?;