Skip to content

Rewrite FileStream in terms of Morsel API#21342

Draft
alamb wants to merge 8 commits intoapache:mainfrom
alamb:alamb/file_stream_split
Draft

Rewrite FileStream in terms of Morsel API#21342
alamb wants to merge 8 commits intoapache:mainfrom
alamb:alamb/file_stream_split

Conversation

@alamb
Copy link
Copy Markdown
Contributor

@alamb alamb commented Apr 3, 2026

Stacked on

Which issue does this PR close?

Rationale for this change

The Morsel API allows for finer grain parallelism (and IO). It is important to have the FileStream work in terms of the Morsel API to allow future features (like workstealing, etc)

What changes are included in this PR?

  1. Rewrite FileStream in terms of the MorselAPI
  2. Add snapshot driven test to document the I/O and CPU patterns in FileStream

Are these changes tested?

Yes by existing functional and benchmark tests, as well as new functional tests

Are there any user-facing changes?

No (not yet)

@github-actions github-actions bot added the datasource Changes to the datasource crate label Apr 3, 2026
@alamb alamb force-pushed the alamb/file_stream_split branch 3 times, most recently from 816d243 to 3346af7 Compare April 3, 2026 16:14
/// This groups together ready planners, ready morsels, the active reader,
/// pending planner I/O, the remaining files and limit, and the metrics
/// associated with processing that work.
pub(super) struct ScanState {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new inner state machine for FileStream

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some more diagrams in the docstring of the struct and/or fields could help. I'm trying to wrap my head around how the IO queue and such work.

use std::sync::Arc;
use std::sync::mpsc::{self, Receiver, TryRecvError};

/// Adapt a legacy [`FileOpener`] to the morsel API.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an adapter so that existing FileOpeners continue to have the same behavior

@@ -0,0 +1,556 @@
// Licensed to the Apache Software Foundation (ASF) under one
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is testing infrastructure to write the snapshot tests

return Poll::Ready(Some(Err(err)));
}
}
FileStreamState::Scan { scan_state: queue } => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the inner state machine into a separate module/struct to try and keep indenting under control and encapsualte the complexity somewhat

assert!(err.contains("FileStreamBuilder invalid partition index: 1"));
}

/// Verifies the simplest morsel-driven flow: one planner produces one
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are tests showing the sequence of calls to the various morsel APIs. I intend to use this framework to show how work can migrate from one stream to the other

@alamb

This comment has been minimized.

@adriangbot

This comment has been minimized.

@adriangbot

This comment has been minimized.

@adriangbot

This comment has been minimized.

@adriangbot

This comment has been minimized.

@adriangbot

This comment has been minimized.

@adriangbot

This comment has been minimized.

@alamb
Copy link
Copy Markdown
Contributor Author

alamb commented Apr 3, 2026

run benchmarks

@adriangbot
Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4184422154-760-2l2l6 6.12.55+ #1 SMP Sun Feb 1 08:59:41 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Comparing alamb/file_stream_split (d5a1f74) to 1e93a67 (merge-base) diff using: clickbench_partitioned
Results will be posted here when complete


File an issue against this benchmark runner

all-features = true

[features]
backtrace = ["datafusion-common/backtrace"]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this while debugging why the tests failed on CI and not locally (it was when this feature flag was on the Error messages got mangled).

I added a crate level feature to enable the feature in datafusion-common so I could reproduce the error locally

@adriangbot
Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4184422154-762-qmphg 6.12.55+ #1 SMP Sun Feb 1 08:59:41 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Comparing alamb/file_stream_split (d5a1f74) to 1e93a67 (merge-base) diff using: tpch
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot
Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4184422154-761-br62n 6.12.55+ #1 SMP Sun Feb 1 08:59:41 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Comparing alamb/file_stream_split (d5a1f74) to 1e93a67 (merge-base) diff using: tpcds
Results will be posted here when complete


File an issue against this benchmark runner

@alamb alamb force-pushed the alamb/file_stream_split branch from d5a1f74 to b2c9bd6 Compare April 3, 2026 17:38
@adriangbot
Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Details

Comparing HEAD and alamb_file_stream_split
--------------------
Benchmark tpch_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Query     ┃                           HEAD ┃        alamb_file_stream_split ┃       Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ QQuery 1  │ 44.73 / 45.33 ±0.67 / 46.50 ms │ 45.15 / 45.71 ±0.85 / 47.39 ms │    no change │
│ QQuery 2  │ 21.06 / 21.46 ±0.34 / 21.95 ms │ 21.06 / 21.88 ±0.99 / 23.46 ms │    no change │
│ QQuery 3  │ 31.07 / 31.28 ±0.20 / 31.61 ms │ 31.37 / 31.77 ±0.56 / 32.88 ms │    no change │
│ QQuery 4  │ 19.76 / 20.32 ±0.56 / 21.28 ms │ 20.61 / 21.08 ±0.46 / 21.84 ms │    no change │
│ QQuery 5  │ 47.41 / 49.95 ±2.38 / 54.13 ms │ 48.42 / 50.55 ±1.10 / 51.61 ms │    no change │
│ QQuery 6  │ 16.68 / 16.87 ±0.12 / 17.05 ms │ 17.14 / 17.29 ±0.11 / 17.40 ms │    no change │
│ QQuery 7  │ 53.06 / 54.21 ±0.79 / 55.26 ms │ 53.02 / 55.10 ±1.39 / 57.07 ms │    no change │
│ QQuery 8  │ 47.23 / 47.40 ±0.13 / 47.61 ms │ 47.99 / 48.78 ±0.72 / 50.05 ms │    no change │
│ QQuery 9  │ 52.74 / 53.77 ±0.58 / 54.54 ms │ 53.04 / 54.54 ±1.24 / 56.72 ms │    no change │
│ QQuery 10 │ 70.54 / 71.49 ±0.97 / 73.15 ms │ 71.27 / 72.29 ±0.98 / 74.03 ms │    no change │
│ QQuery 11 │ 13.85 / 14.16 ±0.24 / 14.47 ms │ 14.14 / 14.89 ±0.75 / 16.31 ms │ 1.05x slower │
│ QQuery 12 │ 27.37 / 27.81 ±0.60 / 28.99 ms │ 27.51 / 27.76 ±0.30 / 28.32 ms │    no change │
│ QQuery 13 │ 38.78 / 39.64 ±0.66 / 40.40 ms │ 38.49 / 39.05 ±0.41 / 39.76 ms │    no change │
│ QQuery 14 │ 27.94 / 28.33 ±0.38 / 29.06 ms │ 27.80 / 28.15 ±0.32 / 28.67 ms │    no change │
│ QQuery 15 │ 32.45 / 33.14 ±0.70 / 34.32 ms │ 33.17 / 33.61 ±0.56 / 34.70 ms │    no change │
│ QQuery 16 │ 16.15 / 16.74 ±0.40 / 17.19 ms │ 15.77 / 16.40 ±0.34 / 16.77 ms │    no change │
│ QQuery 17 │ 72.87 / 73.44 ±0.67 / 74.69 ms │ 71.52 / 72.97 ±1.15 / 74.83 ms │    no change │
│ QQuery 18 │ 76.60 / 78.07 ±0.82 / 79.06 ms │ 74.80 / 77.62 ±2.11 / 80.58 ms │    no change │
│ QQuery 19 │ 36.84 / 37.31 ±0.40 / 37.74 ms │ 37.15 / 37.94 ±0.51 / 38.53 ms │    no change │
│ QQuery 20 │ 39.54 / 40.18 ±0.48 / 40.95 ms │ 39.53 / 40.56 ±0.58 / 41.14 ms │    no change │
│ QQuery 21 │ 62.71 / 63.94 ±1.17 / 65.66 ms │ 63.86 / 66.16 ±1.50 / 68.48 ms │    no change │
│ QQuery 22 │ 18.04 / 18.30 ±0.23 / 18.63 ms │ 17.50 / 18.19 ±0.42 / 18.81 ms │    no change │
└───────────┴────────────────────────────────┴────────────────────────────────┴──────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ Benchmark Summary                      ┃          ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━┩
│ Total Time (HEAD)                      │ 883.11ms │
│ Total Time (alamb_file_stream_split)   │ 892.29ms │
│ Average Time (HEAD)                    │  40.14ms │
│ Average Time (alamb_file_stream_split) │  40.56ms │
│ Queries Faster                         │        0 │
│ Queries Slower                         │        1 │
│ Queries with No Change                 │       21 │
│ Queries with Failure                   │        0 │
└────────────────────────────────────────┴──────────┘

Resource Usage

tpch — base (merge-base)

Metric Value
Wall time 4.7s
Peak memory 4.1 GiB
Avg memory 3.6 GiB
CPU user 33.4s
CPU sys 2.3s
Disk read 0 B
Disk write 268.0 KiB

tpch — branch

Metric Value
Wall time 4.7s
Peak memory 4.1 GiB
Avg memory 3.6 GiB
CPU user 33.7s
CPU sys 2.4s
Disk read 0 B
Disk write 60.0 KiB

File an issue against this benchmark runner

@adriangbot
Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Details

Comparing HEAD and alamb_file_stream_split
--------------------
Benchmark tpcds_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃                                     HEAD ┃                  alamb_file_stream_split ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1  │           43.01 / 43.90 ±0.83 / 45.27 ms │           44.02 / 45.14 ±0.88 / 46.22 ms │     no change │
│ QQuery 2  │        146.87 / 147.52 ±0.49 / 148.27 ms │        148.20 / 148.82 ±0.51 / 149.38 ms │     no change │
│ QQuery 3  │        113.83 / 114.87 ±0.90 / 116.28 ms │        115.29 / 116.32 ±0.74 / 117.53 ms │     no change │
│ QQuery 4  │    1375.63 / 1409.14 ±34.69 / 1464.55 ms │    1366.23 / 1394.12 ±22.09 / 1429.87 ms │     no change │
│ QQuery 5  │        173.61 / 174.89 ±1.04 / 176.30 ms │        175.09 / 176.47 ±1.09 / 177.58 ms │     no change │
│ QQuery 6  │    1006.00 / 1035.32 ±15.22 / 1045.59 ms │     991.15 / 1029.15 ±36.45 / 1082.01 ms │     no change │
│ QQuery 7  │        358.52 / 361.79 ±2.83 / 365.39 ms │        354.24 / 357.94 ±4.12 / 365.39 ms │     no change │
│ QQuery 8  │        115.02 / 117.40 ±1.35 / 118.64 ms │        118.75 / 119.42 ±0.47 / 119.97 ms │     no change │
│ QQuery 9  │        100.64 / 103.30 ±2.74 / 106.77 ms │       102.23 / 108.98 ±10.31 / 129.19 ms │  1.05x slower │
│ QQuery 10 │        105.25 / 107.52 ±1.61 / 109.45 ms │        110.05 / 110.56 ±0.31 / 110.99 ms │     no change │
│ QQuery 11 │      979.59 / 999.74 ±22.68 / 1041.39 ms │       953.46 / 969.94 ±10.02 / 980.75 ms │     no change │
│ QQuery 12 │           45.34 / 46.52 ±1.03 / 48.06 ms │           45.42 / 47.56 ±1.46 / 49.58 ms │     no change │
│ QQuery 13 │        404.72 / 408.16 ±2.50 / 412.38 ms │        399.55 / 407.35 ±4.34 / 412.46 ms │     no change │
│ QQuery 14 │     1029.60 / 1038.05 ±4.98 / 1043.45 ms │     1028.87 / 1037.27 ±5.43 / 1044.66 ms │     no change │
│ QQuery 15 │           16.24 / 17.00 ±0.60 / 17.98 ms │           16.69 / 18.29 ±1.81 / 21.58 ms │  1.08x slower │
│ QQuery 16 │           41.49 / 43.52 ±1.61 / 45.41 ms │           41.62 / 43.32 ±1.53 / 46.12 ms │     no change │
│ QQuery 17 │        240.63 / 249.61 ±5.69 / 257.22 ms │        241.74 / 243.51 ±1.35 / 245.48 ms │     no change │
│ QQuery 18 │        130.74 / 133.15 ±1.69 / 135.27 ms │        130.68 / 132.10 ±0.84 / 132.95 ms │     no change │
│ QQuery 19 │        154.45 / 156.74 ±1.85 / 159.03 ms │        157.00 / 158.30 ±0.89 / 159.15 ms │     no change │
│ QQuery 20 │           14.54 / 15.00 ±0.29 / 15.32 ms │           14.59 / 14.80 ±0.19 / 15.16 ms │     no change │
│ QQuery 21 │           19.99 / 20.66 ±0.81 / 22.12 ms │           19.97 / 20.46 ±0.42 / 21.11 ms │     no change │
│ QQuery 22 │        500.55 / 507.39 ±4.62 / 514.31 ms │        490.32 / 492.79 ±1.81 / 494.85 ms │     no change │
│ QQuery 23 │       911.08 / 939.05 ±14.21 / 949.02 ms │        916.54 / 920.19 ±2.00 / 922.19 ms │     no change │
│ QQuery 24 │        429.73 / 435.36 ±7.04 / 448.69 ms │        415.89 / 419.45 ±3.32 / 424.06 ms │     no change │
│ QQuery 25 │        354.46 / 369.85 ±7.87 / 375.63 ms │        354.30 / 358.14 ±3.00 / 363.31 ms │     no change │
│ QQuery 26 │           81.90 / 83.28 ±0.90 / 84.30 ms │           83.78 / 85.35 ±1.03 / 86.73 ms │     no change │
│ QQuery 27 │        350.06 / 355.35 ±3.56 / 360.63 ms │        349.40 / 351.48 ±1.99 / 354.17 ms │     no change │
│ QQuery 28 │        148.79 / 152.04 ±2.23 / 154.62 ms │        149.73 / 152.28 ±1.95 / 155.04 ms │     no change │
│ QQuery 29 │        299.70 / 301.57 ±1.65 / 304.60 ms │        299.43 / 304.08 ±3.14 / 308.79 ms │     no change │
│ QQuery 30 │           45.71 / 46.89 ±0.91 / 47.99 ms │           44.87 / 46.53 ±0.90 / 47.39 ms │     no change │
│ QQuery 31 │        171.38 / 173.15 ±1.54 / 175.59 ms │        172.94 / 175.24 ±2.07 / 177.98 ms │     no change │
│ QQuery 32 │           56.94 / 59.48 ±2.53 / 64.09 ms │           56.89 / 58.42 ±1.56 / 61.30 ms │     no change │
│ QQuery 33 │        142.75 / 143.75 ±0.52 / 144.19 ms │        141.88 / 143.32 ±1.26 / 145.46 ms │     no change │
│ QQuery 34 │        106.34 / 108.19 ±1.16 / 109.40 ms │        108.44 / 110.07 ±1.93 / 113.84 ms │     no change │
│ QQuery 35 │        106.98 / 108.41 ±1.29 / 110.68 ms │        106.58 / 110.69 ±2.30 / 113.63 ms │     no change │
│ QQuery 36 │        222.15 / 224.75 ±1.47 / 226.62 ms │        225.68 / 229.47 ±4.28 / 234.94 ms │     no change │
│ QQuery 37 │        176.15 / 180.31 ±3.28 / 185.73 ms │        176.29 / 179.50 ±2.48 / 183.75 ms │     no change │
│ QQuery 38 │           87.67 / 91.03 ±2.54 / 94.38 ms │           88.19 / 90.95 ±1.74 / 92.59 ms │     no change │
│ QQuery 39 │        128.17 / 131.01 ±2.45 / 134.96 ms │        125.67 / 128.69 ±2.20 / 130.79 ms │     no change │
│ QQuery 40 │        116.84 / 121.00 ±5.29 / 131.45 ms │        110.57 / 116.92 ±5.23 / 125.02 ms │     no change │
│ QQuery 41 │           14.90 / 15.44 ±0.38 / 16.04 ms │           14.85 / 15.98 ±0.66 / 16.85 ms │     no change │
│ QQuery 42 │        107.53 / 109.52 ±1.06 / 110.51 ms │        109.94 / 112.70 ±2.49 / 116.26 ms │     no change │
│ QQuery 43 │           83.55 / 84.20 ±0.56 / 85.15 ms │           84.44 / 85.24 ±0.57 / 85.99 ms │     no change │
│ QQuery 44 │           11.96 / 12.40 ±0.49 / 13.22 ms │           11.41 / 11.73 ±0.27 / 12.14 ms │ +1.06x faster │
│ QQuery 45 │           52.71 / 54.35 ±1.14 / 55.98 ms │           52.51 / 53.82 ±1.57 / 56.73 ms │     no change │
│ QQuery 46 │        234.98 / 238.00 ±1.65 / 239.95 ms │        234.56 / 237.67 ±3.74 / 244.62 ms │     no change │
│ QQuery 47 │        736.25 / 741.19 ±4.60 / 748.71 ms │        730.16 / 736.86 ±3.61 / 740.53 ms │     no change │
│ QQuery 48 │        287.64 / 295.49 ±5.09 / 301.24 ms │        285.40 / 291.67 ±3.94 / 296.83 ms │     no change │
│ QQuery 49 │        257.90 / 261.48 ±4.69 / 270.29 ms │        255.67 / 259.24 ±2.77 / 262.80 ms │     no change │
│ QQuery 50 │        234.67 / 239.69 ±2.83 / 243.31 ms │        232.20 / 236.22 ±4.07 / 243.84 ms │     no change │
│ QQuery 51 │        180.52 / 186.27 ±3.04 / 189.52 ms │        184.27 / 190.08 ±3.92 / 195.55 ms │     no change │
│ QQuery 52 │        109.05 / 111.07 ±1.41 / 113.29 ms │        109.66 / 110.83 ±0.97 / 112.31 ms │     no change │
│ QQuery 53 │        102.54 / 105.24 ±2.26 / 109.22 ms │        103.20 / 104.35 ±1.00 / 106.03 ms │     no change │
│ QQuery 54 │        147.04 / 149.62 ±1.90 / 152.60 ms │        148.82 / 151.96 ±2.29 / 154.87 ms │     no change │
│ QQuery 55 │        107.96 / 109.29 ±1.00 / 110.48 ms │        109.40 / 110.67 ±0.80 / 111.59 ms │     no change │
│ QQuery 56 │        140.94 / 143.05 ±2.83 / 148.57 ms │        142.78 / 143.90 ±1.39 / 146.62 ms │     no change │
│ QQuery 57 │        174.29 / 179.13 ±4.20 / 186.37 ms │        174.43 / 176.70 ±1.30 / 178.37 ms │     no change │
│ QQuery 58 │        299.14 / 304.07 ±3.37 / 309.58 ms │        291.63 / 300.56 ±7.01 / 309.74 ms │     no change │
│ QQuery 59 │        200.78 / 202.13 ±1.16 / 203.75 ms │        197.95 / 204.54 ±6.37 / 216.61 ms │     no change │
│ QQuery 60 │        141.55 / 145.16 ±2.68 / 149.77 ms │        144.44 / 146.17 ±1.22 / 147.87 ms │     no change │
│ QQuery 61 │        172.08 / 173.31 ±0.77 / 174.45 ms │        173.23 / 175.30 ±1.97 / 178.32 ms │     no change │
│ QQuery 62 │      935.68 / 972.81 ±28.46 / 1020.06 ms │      889.29 / 977.95 ±59.42 / 1066.64 ms │     no change │
│ QQuery 63 │        103.98 / 108.70 ±3.93 / 115.88 ms │        105.04 / 109.65 ±3.94 / 115.34 ms │     no change │
│ QQuery 64 │        707.13 / 714.99 ±4.93 / 719.47 ms │        706.11 / 708.80 ±1.66 / 710.73 ms │     no change │
│ QQuery 65 │        253.96 / 258.62 ±4.41 / 265.05 ms │        257.18 / 260.50 ±2.53 / 264.15 ms │     no change │
│ QQuery 66 │       232.81 / 256.23 ±14.44 / 272.79 ms │        240.32 / 252.97 ±7.09 / 262.02 ms │     no change │
│ QQuery 67 │        309.67 / 323.00 ±7.74 / 332.16 ms │        311.77 / 324.19 ±6.70 / 330.24 ms │     no change │
│ QQuery 68 │        278.20 / 286.07 ±4.45 / 291.59 ms │        285.12 / 292.19 ±7.87 / 306.19 ms │     no change │
│ QQuery 69 │        103.18 / 103.65 ±0.37 / 104.28 ms │        105.24 / 106.52 ±1.10 / 107.95 ms │     no change │
│ QQuery 70 │        334.58 / 346.72 ±8.21 / 359.19 ms │       324.77 / 347.65 ±17.26 / 378.18 ms │     no change │
│ QQuery 71 │        138.27 / 141.76 ±2.63 / 145.87 ms │        134.82 / 138.27 ±2.37 / 140.86 ms │     no change │
│ QQuery 72 │       710.36 / 733.06 ±14.86 / 752.19 ms │       726.09 / 740.62 ±13.28 / 765.63 ms │     no change │
│ QQuery 73 │        103.87 / 105.18 ±1.41 / 107.85 ms │        104.93 / 106.97 ±1.54 / 109.10 ms │     no change │
│ QQuery 74 │        610.23 / 615.44 ±4.39 / 623.12 ms │        613.41 / 619.83 ±4.84 / 625.39 ms │     no change │
│ QQuery 75 │        277.94 / 279.72 ±1.15 / 281.37 ms │        279.23 / 281.40 ±1.46 / 283.83 ms │     no change │
│ QQuery 76 │        133.66 / 135.75 ±1.63 / 138.05 ms │        133.59 / 136.39 ±2.40 / 139.44 ms │     no change │
│ QQuery 77 │        189.98 / 192.51 ±2.20 / 195.58 ms │        190.25 / 190.99 ±0.60 / 191.83 ms │     no change │
│ QQuery 78 │        353.55 / 363.41 ±7.25 / 376.16 ms │        352.41 / 358.89 ±3.93 / 364.12 ms │     no change │
│ QQuery 79 │        236.85 / 240.86 ±2.86 / 244.52 ms │        238.77 / 240.80 ±1.45 / 242.78 ms │     no change │
│ QQuery 80 │        330.23 / 334.13 ±3.73 / 340.81 ms │        329.23 / 335.06 ±3.81 / 339.87 ms │     no change │
│ QQuery 81 │           27.21 / 28.36 ±0.83 / 29.36 ms │           26.62 / 27.73 ±1.15 / 29.89 ms │     no change │
│ QQuery 82 │        197.72 / 200.80 ±2.28 / 203.51 ms │        199.35 / 201.71 ±2.33 / 205.85 ms │     no change │
│ QQuery 83 │           40.95 / 41.95 ±0.92 / 43.47 ms │           39.32 / 41.36 ±1.20 / 42.76 ms │     no change │
│ QQuery 84 │           49.75 / 51.21 ±1.26 / 52.95 ms │           49.43 / 49.84 ±0.43 / 50.51 ms │     no change │
│ QQuery 85 │        145.35 / 148.99 ±2.44 / 152.14 ms │        151.09 / 151.66 ±0.57 / 152.55 ms │     no change │
│ QQuery 86 │           39.16 / 40.05 ±0.53 / 40.56 ms │           39.91 / 41.92 ±1.53 / 43.79 ms │     no change │
│ QQuery 87 │           87.46 / 90.19 ±2.45 / 94.16 ms │           86.55 / 89.42 ±3.04 / 94.70 ms │     no change │
│ QQuery 88 │         99.45 / 101.37 ±1.42 / 103.70 ms │        101.23 / 102.65 ±1.32 / 104.96 ms │     no change │
│ QQuery 89 │        117.99 / 119.68 ±1.49 / 121.52 ms │        118.18 / 120.45 ±1.57 / 122.48 ms │     no change │
│ QQuery 90 │           23.24 / 24.22 ±0.74 / 25.10 ms │           24.56 / 24.85 ±0.21 / 25.18 ms │     no change │
│ QQuery 91 │           63.72 / 64.48 ±0.75 / 65.85 ms │           65.25 / 66.07 ±0.61 / 67.04 ms │     no change │
│ QQuery 92 │           56.76 / 58.74 ±1.24 / 60.30 ms │           60.30 / 61.02 ±0.68 / 62.01 ms │     no change │
│ QQuery 93 │        193.44 / 198.30 ±3.84 / 202.85 ms │        195.66 / 200.78 ±4.26 / 207.05 ms │     no change │
│ QQuery 94 │           61.97 / 63.04 ±0.84 / 64.16 ms │           63.05 / 63.51 ±0.44 / 64.21 ms │     no change │
│ QQuery 95 │        135.71 / 139.15 ±2.60 / 142.54 ms │        134.71 / 137.22 ±2.04 / 139.60 ms │     no change │
│ QQuery 96 │           73.96 / 74.78 ±0.64 / 75.73 ms │           70.80 / 75.40 ±2.66 / 78.31 ms │     no change │
│ QQuery 97 │        131.46 / 132.44 ±0.69 / 133.31 ms │        128.74 / 132.93 ±3.07 / 137.90 ms │     no change │
│ QQuery 98 │        154.75 / 157.03 ±2.38 / 161.34 ms │        154.00 / 158.12 ±2.48 / 161.44 ms │     no change │
│ QQuery 99 │ 10760.81 / 10814.73 ±42.36 / 10868.87 ms │ 10775.01 / 10876.19 ±73.35 / 10994.89 ms │     no change │
└───────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                      ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                      │ 34197.89ms │
│ Total Time (alamb_file_stream_split)   │ 34182.06ms │
│ Average Time (HEAD)                    │   345.43ms │
│ Average Time (alamb_file_stream_split) │   345.27ms │
│ Queries Faster                         │          1 │
│ Queries Slower                         │          2 │
│ Queries with No Change                 │         96 │
│ Queries with Failure                   │          0 │
└────────────────────────────────────────┴────────────┘

Resource Usage

tpcds — base (merge-base)

Metric Value
Wall time 171.3s
Peak memory 5.5 GiB
Avg memory 4.5 GiB
CPU user 275.7s
CPU sys 19.0s
Disk read 0 B
Disk write 638.1 MiB

tpcds — branch

Metric Value
Wall time 171.2s
Peak memory 4.9 GiB
Avg memory 4.3 GiB
CPU user 275.0s
CPU sys 18.3s
Disk read 0 B
Disk write 176.0 KiB

File an issue against this benchmark runner

@adriangbot
Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Details

Comparing HEAD and alamb_file_stream_split
--------------------
Benchmark clickbench_partitioned.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃                                  HEAD ┃               alamb_file_stream_split ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0  │          1.28 / 4.56 ±6.38 / 17.32 ms │          1.29 / 4.59 ±6.45 / 17.48 ms │     no change │
│ QQuery 1  │        14.45 / 14.83 ±0.29 / 15.30 ms │        14.52 / 14.84 ±0.22 / 15.08 ms │     no change │
│ QQuery 2  │        43.15 / 43.80 ±0.37 / 44.23 ms │        44.21 / 44.86 ±0.43 / 45.38 ms │     no change │
│ QQuery 3  │        42.44 / 43.84 ±1.35 / 45.75 ms │        42.84 / 45.40 ±2.04 / 48.54 ms │     no change │
│ QQuery 4  │     293.40 / 302.61 ±6.43 / 312.97 ms │     295.44 / 306.80 ±8.36 / 315.87 ms │     no change │
│ QQuery 5  │     348.53 / 357.67 ±6.04 / 366.97 ms │     347.90 / 353.40 ±3.43 / 357.52 ms │     no change │
│ QQuery 6  │           6.27 / 6.86 ±0.60 / 7.60 ms │          5.53 / 8.97 ±4.12 / 17.06 ms │  1.31x slower │
│ QQuery 7  │        17.03 / 17.30 ±0.16 / 17.45 ms │        17.11 / 17.46 ±0.31 / 18.02 ms │     no change │
│ QQuery 8  │     422.30 / 430.38 ±8.65 / 441.38 ms │    425.20 / 442.45 ±10.23 / 454.07 ms │     no change │
│ QQuery 9  │     666.94 / 673.76 ±4.71 / 679.54 ms │     659.34 / 666.90 ±5.79 / 674.94 ms │     no change │
│ QQuery 10 │       93.70 / 96.54 ±2.67 / 101.21 ms │       95.22 / 98.44 ±3.22 / 103.92 ms │     no change │
│ QQuery 11 │     106.03 / 108.02 ±2.04 / 110.66 ms │     109.21 / 111.20 ±2.45 / 115.86 ms │     no change │
│ QQuery 12 │     356.37 / 359.05 ±2.40 / 363.37 ms │    348.84 / 358.60 ±10.70 / 378.89 ms │     no change │
│ QQuery 13 │     456.55 / 472.45 ±8.46 / 479.79 ms │     470.70 / 479.28 ±4.91 / 484.80 ms │     no change │
│ QQuery 14 │     353.11 / 357.96 ±4.35 / 363.31 ms │     356.76 / 364.93 ±4.81 / 369.39 ms │     no change │
│ QQuery 15 │    361.20 / 379.97 ±17.79 / 409.34 ms │     373.04 / 380.83 ±6.15 / 387.20 ms │     no change │
│ QQuery 16 │     723.93 / 736.99 ±9.02 / 750.39 ms │    730.98 / 766.41 ±49.17 / 863.43 ms │     no change │
│ QQuery 17 │    724.66 / 750.84 ±32.92 / 812.71 ms │    734.92 / 752.62 ±16.05 / 776.38 ms │     no change │
│ QQuery 18 │ 1469.64 / 1497.44 ±33.01 / 1554.21 ms │ 1384.92 / 1404.34 ±11.39 / 1416.83 ms │ +1.07x faster │
│ QQuery 19 │        35.78 / 38.62 ±2.83 / 43.83 ms │        35.71 / 37.27 ±1.09 / 39.12 ms │     no change │
│ QQuery 20 │    724.81 / 740.73 ±20.13 / 775.83 ms │    719.78 / 732.59 ±12.53 / 751.33 ms │     no change │
│ QQuery 21 │    768.91 / 784.95 ±14.35 / 810.41 ms │     761.62 / 769.49 ±6.08 / 779.22 ms │     no change │
│ QQuery 22 │ 1141.81 / 1168.49 ±28.20 / 1211.74 ms │  1136.09 / 1138.50 ±2.05 / 1141.45 ms │     no change │
│ QQuery 23 │ 3098.68 / 3114.32 ±15.70 / 3142.44 ms │ 3125.61 / 3158.65 ±23.36 / 3197.22 ms │     no change │
│ QQuery 24 │      99.46 / 103.17 ±2.29 / 105.56 ms │     102.43 / 105.22 ±2.71 / 108.69 ms │     no change │
│ QQuery 25 │     141.01 / 143.76 ±2.15 / 147.07 ms │     143.07 / 144.23 ±0.99 / 145.47 ms │     no change │
│ QQuery 26 │     101.31 / 103.47 ±1.23 / 104.75 ms │     103.87 / 106.46 ±1.82 / 108.52 ms │     no change │
│ QQuery 27 │     863.27 / 867.76 ±4.38 / 875.96 ms │     853.86 / 862.98 ±9.50 / 878.42 ms │     no change │
│ QQuery 28 │ 7742.92 / 7789.31 ±25.98 / 7822.06 ms │ 7701.81 / 7799.69 ±49.34 / 7833.96 ms │     no change │
│ QQuery 29 │       49.81 / 62.31 ±16.81 / 95.36 ms │        50.70 / 53.72 ±4.44 / 62.35 ms │ +1.16x faster │
│ QQuery 30 │    371.63 / 384.56 ±17.02 / 417.81 ms │     367.36 / 372.11 ±3.80 / 377.93 ms │     no change │
│ QQuery 31 │     388.79 / 396.63 ±6.19 / 405.98 ms │     377.23 / 387.84 ±8.77 / 403.21 ms │     no change │
│ QQuery 32 │ 1038.41 / 1070.50 ±43.75 / 1157.22 ms │ 1063.06 / 1081.12 ±13.74 / 1103.98 ms │     no change │
│ QQuery 33 │  1498.29 / 1512.04 ±8.58 / 1524.73 ms │  1499.82 / 1511.88 ±9.96 / 1523.13 ms │     no change │
│ QQuery 34 │ 1472.74 / 1495.67 ±12.97 / 1510.09 ms │  1486.27 / 1494.13 ±8.86 / 1507.87 ms │     no change │
│ QQuery 35 │     396.06 / 403.28 ±4.87 / 408.53 ms │     403.59 / 411.20 ±5.93 / 421.39 ms │     no change │
│ QQuery 36 │     113.25 / 122.11 ±4.93 / 127.78 ms │     118.72 / 124.40 ±4.38 / 131.28 ms │     no change │
│ QQuery 37 │        48.75 / 51.21 ±1.64 / 53.74 ms │        48.61 / 50.49 ±1.45 / 52.73 ms │     no change │
│ QQuery 38 │        77.13 / 78.89 ±1.04 / 80.35 ms │        76.73 / 77.57 ±0.68 / 78.60 ms │     no change │
│ QQuery 39 │     220.50 / 227.67 ±4.77 / 232.25 ms │     214.14 / 225.93 ±6.48 / 231.84 ms │     no change │
│ QQuery 40 │        24.79 / 25.69 ±1.11 / 27.55 ms │        25.14 / 27.46 ±1.84 / 30.64 ms │  1.07x slower │
│ QQuery 41 │        20.01 / 20.99 ±0.67 / 22.03 ms │        20.58 / 22.60 ±2.56 / 27.64 ms │  1.08x slower │
│ QQuery 42 │        19.79 / 19.96 ±0.13 / 20.14 ms │        20.01 / 20.76 ±0.53 / 21.60 ms │     no change │
└───────────┴───────────────────────────────────────┴───────────────────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                      ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                      │ 27380.95ms │
│ Total Time (alamb_file_stream_split)   │ 27338.62ms │
│ Average Time (HEAD)                    │   636.77ms │
│ Average Time (alamb_file_stream_split) │   635.78ms │
│ Queries Faster                         │          2 │
│ Queries Slower                         │          3 │
│ Queries with No Change                 │         38 │
│ Queries with Failure                   │          0 │
└────────────────────────────────────────┴────────────┘

Resource Usage

clickbench_partitioned — base (merge-base)

Metric Value
Wall time 138.1s
Peak memory 43.5 GiB
Avg memory 29.7 GiB
CPU user 1301.4s
CPU sys 90.9s
Disk read 0 B
Disk write 3.9 GiB

clickbench_partitioned — branch

Metric Value
Wall time 137.8s
Peak memory 40.3 GiB
Avg memory 33.8 GiB
CPU user 1305.8s
CPU sys 83.7s
Disk read 0 B
Disk write 120.0 KiB

File an issue against this benchmark runner

Copy link
Copy Markdown
Contributor

@adriangb adriangb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran out of time for the last couple of files. A lot of the comments are just tracking my thought process, I plan to go over them again to clarify my own understanding but maybe they're helpful as input on how the code reads top to bottom for a first time reader.

Comment on lines +78 to +93
/// Creates a `dyn Morselizer` based on given parameters.
///
/// The default implementation preserves existing behavior by adapting the
/// legacy [`FileOpener`] API into a [`Morselizer`].
///
/// It is preferred to implement the [`Morselizer`] API directly by
/// implementing this method.
fn create_morselizer(
&self,
object_store: Arc<dyn ObjectStore>,
base_config: &FileScanConfig,
partition: usize,
) -> Result<Box<dyn Morselizer>> {
let opener = self.create_file_opener(object_store, base_config, partition)?;
Ok(Box::new(FileOpenerMorselizer::new(opener)))
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

_partition: usize,
) -> datafusion_common::Result<Arc<dyn FileOpener>> {
datafusion_common::internal_err!(
"ParquetSource::create_file_opener called but it supports the Morsel API"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"ParquetSource::create_file_opener called but it supports the Morsel API"
"ParquetSource::create_file_opener called but it supports the Morsel API, please use that instead"

Note that this will be a breaking change for folks using ParquetSource directly (which I believe @xudong963 / @zhuqi-lucas are based on #21290).

/// Configure the [`FileOpener`] used to open files.
///
/// This will overwrite any setting from [`Self::with_morselizer`]
pub fn with_file_opener(mut self, file_opener: Arc<dyn FileOpener>) -> Self {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I think it could make sense to keep FileOpener as a public API for building data sources (if we consider it simpler, for folks who don't care about perf), this method in particular seems like a mostly internal method (even if it is pub) on we might as well deprecate / remove.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is the way we could keep using FileOpener (as it is simpler)

I am not sure how we could still allow using FileOpener but not keep this method

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignoring, done in #21340

Comment on lines +82 to 85
if let FileStreamState::Scan { scan_state } = &mut self.state {
scan_state.set_on_error(on_error);
}
self
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this is the only state it makes sense to modify (the others are terminal states). But I did have to go check the FileStreamState enum to confirm. Might be worth either adding a comment here or just doing a match with FileStreamState::Error(_) | FileStreamState::Done(_) and add a comment on top explaining those are terminal states + to force ourselves to handle new cases in the future if they were added. It would be an annoying bug to debug, worth the 1 LOC IMO.

Comment on lines +61 to +62
/// The active reader, if any.
reader: Option<BoxStream<'static, Result<RecordBatch>>>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there one ScanState across all partitions or one per partition? I'm guessing the latter: file_iter: VecDeque<PartitionedFile> is the files for this partition, we pump all of the files into one output stream of RecordBatch (reader). But we can have multiple planners / morsels ready and merge those all into a single stream of RecordBatch on the way out.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One per partition

we pump all of the files into one output stream of RecordBatch (reader). But we can have multiple planners / morsels ready and merge those all into a single stream of RecordBatch on the way out.

My initial proposal (following @Dandandan 's original design" is that when possible the files are put into a shared queue so that when a FileStream is ready it gets the next file

I think once we get that structure in place, we can contemplate more sophisticated designs (like one filestream preparing a parquet file, and then divying up the record batches between other cores)

}

if let Some(morsel) = self.ready_morsels.pop_front() {
self.metrics.files_opened.add(1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does a morsel map to a file opened? I thought opening a file produces the morsels (i.e. this metric should be incremented elsewhere).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right -- the files opened should be for files "morselized"

Comment on lines +199 to +200
self.ready_morsels.extend(plan.take_morsels());
self.ready_planners.extend(plan.take_planners());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now, a planner can produce more planners (this is how it cycles through IO and CPU)

@alamb
Copy link
Copy Markdown
Contributor Author

alamb commented Apr 6, 2026

Thanks @adriangb -- I think I am now convinced this will make things faster (see #21351)

Once I finalze that I will then go back and ping / respond to each of these PRs in turn

@alamb
Copy link
Copy Markdown
Contributor Author

alamb commented Apr 6, 2026

Ok the first PR in the chain is ready for review:

(that is basically 50% of this PR)

Copy link
Copy Markdown
Contributor Author

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comments @adriangb

Once I get this PR merged

I will come back and update this PR / address your comments

/// Configure the [`FileOpener`] used to open files.
///
/// This will overwrite any setting from [`Self::with_morselizer`]
pub fn with_file_opener(mut self, file_opener: Arc<dyn FileOpener>) -> Self {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is the way we could keep using FileOpener (as it is simpler)

I am not sure how we could still allow using FileOpener but not keep this method

Comment on lines +53 to +60
/// The file-format-specific morselizer used to plan files.
morselizer: Box<dyn Morselizer>,
/// Describes the behavior if opening or scanning a file fails.
on_error: OnError,
/// CPU-ready planners for the current file.
ready_planners: VecDeque<Box<dyn MorselPlanner>>,
/// Ready morsels for the current file.
ready_morsels: VecDeque<Box<dyn Morsel>>,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding of the state machine is File -> MorselPlanner (via Morselizer, an IO operation) and then MorselPlanner -> Morsel (a CPU operation) and finally Morsel -> RecordBatch(es) (IO). Is that right?

That is basically right, except the last step Morsel --> RecordBatch(es) should not have IO (though you are right that it does now)

Operations like Morsel -> RecordBatch are still a mix of IO/CPU (especially with filter pushdown on).

My idea is that we change that so that the RecordBatches don't actually flow until we have all data buffered and ready to decode

This is possible to do with the arrow-rs parquet reader when:

  1. Each MorselPlanner is for a single RowGroup
  2. We don't produce the morsel stream until we start getting batches (there is some version of that in Sketch out a Morselize API #20820)

Comment on lines +61 to +62
/// The active reader, if any.
reader: Option<BoxStream<'static, Result<RecordBatch>>>,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One per partition

we pump all of the files into one output stream of RecordBatch (reader). But we can have multiple planners / morsels ready and merge those all into a single stream of RecordBatch on the way out.

My initial proposal (following @Dandandan 's original design" is that when possible the files are put into a shared queue so that when a FileStream is ready it gets the next file

I think once we get that structure in place, we can contemplate more sophisticated designs (like one filestream preparing a parquet file, and then divying up the record batches between other cores)

}

if let Some(morsel) = self.ready_morsels.pop_front() {
self.metrics.files_opened.add(1);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right -- the files opened should be for files "morselized"

@alamb alamb force-pushed the alamb/file_stream_split branch from 8985e37 to 4084de9 Compare April 8, 2026 16:21
github-merge-queue bot pushed a commit that referenced this pull request Apr 9, 2026
…er` (#21327)

~(Draft until I am sure I can use this API to make FileStream behave
better)~

## Which issue does this PR close?

- part of #20529
- Needed for #21351
- Broken out of #20820
- Closes #21427

## Rationale for this change

I can get 10% faster on many ClickBench queries by reordeirng files at
runtime. You can see it all working together here:
#21351

To do do, I need to rework the FileStream so that it can reorder
operations at runtime. Eventually that will include both CPU and IO.

This PR is a step in the direction by introducing the main Morsel API
and implementing it for Parquet. The next PR
(#21342) rewrites FileStream in
terms of the Morsel API

## What changes are included in this PR?

1. Add proposed `Morsel` API
2. Rewrite Parquet opener in terms of that API
3. Add an adapter layer (back to FileOpener, so I don't have to rewrite
FileStream in the same PR)

My next PR will rewrite the FileStream to use the Morsel API

## Are these changes tested?

Yes by existing CI.

I will work on adding additional tests for just Parquet opener in a
follow on PR

## Are there any user-facing changes?
No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

datasource Changes to the datasource crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants