Skip to content

Upgrade to arrow/parquet 55, and object_store to 0.12.0 and pyo3 to 0.24.0 #15466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Apr 14, 2025

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Mar 27, 2025

This PR upgrades to the latest arrow/parquet release and all the dependencies.

I used this PR to test the arrow/parquet 55 release prior to creating an RC.

Some benchmark results show performance is as good or better (see below)

I havn't figured out exactly why but I theorize it is at least in part due to @rluvaton 's PR to improve concat

@github-actions github-actions bot added the common Related to common crate label Mar 28, 2025
@github-actions github-actions bot added the functions Changes to functions implementation label Mar 28, 2025
@alamb alamb changed the title (WIP) Upgrading to arrow 55 (WIP) Test Upgrading to arrow 55 Apr 7, 2025
@github-actions github-actions bot added core Core DataFusion crate execution Related to the execution crate proto Related to proto crate datasource Changes to the datasource crate labels Apr 7, 2025
@@ -166,7 +166,7 @@ impl ObjectStore for BlockingObjectStore {
fn list(
&self,
prefix: Option<&Path>,
) -> BoxStream<'_, object_store::Result<ObjectMeta>> {
) -> BoxStream<'static, object_store::Result<ObjectMeta>> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -305,7 +305,7 @@ impl FileOpener for ArrowOpener {
)?;
// read footer according to footer_len
let get_option = GetOptions {
range: Some(GetRange::Suffix(10 + footer_len)),
range: Some(GetRange::Suffix(10 + (footer_len as u64))),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The changes to usize/u64 are for better wasm support, see

self.inner.get_metadata()
fn get_metadata<'a>(
&'a mut self,
options: Option<&'a ArrowReaderOptions>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -44,7 +44,7 @@ datafusion-common = { workspace = true, default-features = true }
datafusion-expr = { workspace = true }
futures = { workspace = true }
log = { workspace = true }
object_store = { workspace = true }
object_store = { workspace = true, features = ["fs"] }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -884,7 +884,7 @@ SELECT extract(day from arrow_cast('14400 minutes', 'Interval(DayTime)'))
query I
SELECT extract(minute from arrow_cast('14400 minutes', 'Interval(DayTime)'))
----
14400
0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@github-actions github-actions bot added the substrait Changes to the substrait crate label Apr 7, 2025
@alamb alamb changed the title (WIP) Test Upgrading to arrow 55 (WIP) Upgrade to arrow 55 Apr 8, 2025
@alamb alamb changed the title (WIP) Upgrade to arrow 55 (WIP) Upgrade to arrow/parquet 55 Apr 8, 2025
use rand::Rng;
use rand::SeedableRng;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I inlined the small amount of code from bench_util so this benchmark is standalone and easier to understand what is tested

@alamb
Copy link
Contributor Author

alamb commented Apr 9, 2025

🤖 ./gh_compare_branch.sh Benchmark Script Running
Linux aal-dev 6.8.0-1016-gcp #18-Ubuntu SMP Fri Oct 4 22:16:29 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Comparing alamb/test_upgrade_54 (86aab05) to 784df33 diff
Benchmarks: tpch_mem clickbench_partitioned clickbench_extended
Results will be posted here when complete

@alamb
Copy link
Contributor Author

alamb commented Apr 9, 2025

🤖: Benchmark completed

Details

Comparing HEAD and alamb_test_upgrade_54
--------------------
Benchmark clickbench_extended.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃       HEAD ┃ alamb_test_upgrade_54 ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0     │  1981.40ms │             1948.43ms │     no change │
│ QQuery 1     │   720.32ms │              721.66ms │     no change │
│ QQuery 2     │  1429.66ms │             1483.79ms │     no change │
│ QQuery 3     │   727.52ms │              723.50ms │     no change │
│ QQuery 4     │  1481.60ms │             1474.85ms │     no change │
│ QQuery 5     │ 16900.01ms │            15889.88ms │ +1.06x faster │
│ QQuery 6     │  2040.21ms │             2065.32ms │     no change │
└──────────────┴────────────┴───────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                    ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                    │ 25280.71ms │
│ Total Time (alamb_test_upgrade_54)   │ 24307.43ms │
│ Average Time (HEAD)                  │  3611.53ms │
│ Average Time (alamb_test_upgrade_54) │  3472.49ms │
│ Queries Faster                       │          1 │
│ Queries Slower                       │          0 │
│ Queries with No Change               │          6 │
└──────────────────────────────────────┴────────────┘
--------------------
Benchmark clickbench_partitioned.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃       HEAD ┃ alamb_test_upgrade_54 ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0     │     3.03ms │                2.37ms │ +1.28x faster │
│ QQuery 1     │    38.93ms │               38.09ms │     no change │
│ QQuery 2     │    94.89ms │               90.32ms │     no change │
│ QQuery 3     │   103.63ms │               99.62ms │     no change │
│ QQuery 4     │   894.48ms │              747.89ms │ +1.20x faster │
│ QQuery 5     │   959.49ms │              879.98ms │ +1.09x faster │
│ QQuery 6     │     2.48ms │                1.88ms │ +1.32x faster │
│ QQuery 7     │    44.43ms │               44.93ms │     no change │
│ QQuery 8     │  1020.50ms │              906.90ms │ +1.13x faster │
│ QQuery 9     │  1457.74ms │             1208.98ms │ +1.21x faster │
│ QQuery 10    │   286.57ms │              270.88ms │ +1.06x faster │
│ QQuery 11    │   322.13ms │              310.42ms │     no change │
│ QQuery 12    │  1028.94ms │              918.73ms │ +1.12x faster │
│ QQuery 13    │  1487.53ms │             1401.51ms │ +1.06x faster │
│ QQuery 14    │   948.47ms │              863.41ms │ +1.10x faster │
│ QQuery 15    │  1148.04ms │             1055.15ms │ +1.09x faster │
│ QQuery 16    │  1908.90ms │             1779.63ms │ +1.07x faster │
│ QQuery 17    │  1794.66ms │             1645.24ms │ +1.09x faster │
│ QQuery 18    │  3366.04ms │             3162.38ms │ +1.06x faster │
│ QQuery 19    │    92.27ms │               84.64ms │ +1.09x faster │
│ QQuery 20    │  1228.36ms │             1147.43ms │ +1.07x faster │
│ QQuery 21    │  1413.98ms │             1344.48ms │     no change │
│ QQuery 22    │  2506.03ms │             2358.29ms │ +1.06x faster │
│ QQuery 23    │  9004.64ms │             8567.92ms │     no change │
│ QQuery 24    │   512.34ms │              474.61ms │ +1.08x faster │
│ QQuery 25    │   410.78ms │              391.33ms │     no change │
│ QQuery 26    │   572.85ms │              541.29ms │ +1.06x faster │
│ QQuery 27    │  1706.69ms │             1695.40ms │     no change │
│ QQuery 28    │ 13103.90ms │            12559.44ms │     no change │
│ QQuery 29    │   552.29ms │              542.01ms │     no change │
│ QQuery 30    │   904.32ms │              844.04ms │ +1.07x faster │
│ QQuery 31    │   943.68ms │              901.04ms │     no change │
│ QQuery 32    │  3041.68ms │             2733.91ms │ +1.11x faster │
│ QQuery 33    │  3762.99ms │             3409.88ms │ +1.10x faster │
│ QQuery 34    │  3848.12ms │             3493.28ms │ +1.10x faster │
│ QQuery 35    │  1360.59ms │             1335.12ms │     no change │
│ QQuery 36    │   129.70ms │              129.64ms │     no change │
│ QQuery 37    │    59.98ms │               58.72ms │     no change │
│ QQuery 38    │   125.37ms │              125.25ms │     no change │
│ QQuery 39    │   197.61ms │              202.15ms │     no change │
│ QQuery 40    │    47.36ms │               48.55ms │     no change │
│ QQuery 41    │    44.57ms │               45.87ms │     no change │
│ QQuery 42    │    40.00ms │               40.47ms │     no change │
└──────────────┴────────────┴───────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                    ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                    │ 62520.96ms │
│ Total Time (alamb_test_upgrade_54)   │ 58503.03ms │
│ Average Time (HEAD)                  │  1453.98ms │
│ Average Time (alamb_test_upgrade_54) │  1360.54ms │
│ Queries Faster                       │         23 │
│ Queries Slower                       │          0 │
│ Queries with No Change               │         20 │
└──────────────────────────────────────┴────────────┘
--------------------
Benchmark tpch_mem_sf1.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃     HEAD ┃ alamb_test_upgrade_54 ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1     │ 136.26ms │              121.79ms │ +1.12x faster │
│ QQuery 2     │  27.03ms │               23.96ms │ +1.13x faster │
│ QQuery 3     │  40.96ms │               34.86ms │ +1.17x faster │
│ QQuery 4     │  22.81ms │               21.62ms │ +1.06x faster │
│ QQuery 5     │  62.52ms │               61.53ms │     no change │
│ QQuery 6     │   9.40ms │                9.17ms │     no change │
│ QQuery 7     │ 111.59ms │              112.52ms │     no change │
│ QQuery 8     │  29.92ms │               27.85ms │ +1.07x faster │
│ QQuery 9     │  73.03ms │               64.47ms │ +1.13x faster │
│ QQuery 10    │  64.50ms │               62.95ms │     no change │
│ QQuery 11    │  14.46ms │               13.96ms │     no change │
│ QQuery 12    │  41.86ms │               37.01ms │ +1.13x faster │
│ QQuery 13    │  32.39ms │               31.69ms │     no change │
│ QQuery 14    │  11.14ms │                9.97ms │ +1.12x faster │
│ QQuery 15    │  29.00ms │               27.53ms │ +1.05x faster │
│ QQuery 16    │  24.22ms │               26.48ms │  1.09x slower │
│ QQuery 17    │ 110.86ms │              106.57ms │     no change │
│ QQuery 18    │ 267.60ms │              263.78ms │     no change │
│ QQuery 19    │  30.41ms │               29.82ms │     no change │
│ QQuery 20    │  41.97ms │               42.76ms │     no change │
│ QQuery 21    │ 192.03ms │              192.47ms │     no change │
│ QQuery 22    │  19.54ms │               18.46ms │ +1.06x faster │
└──────────────┴──────────┴───────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary                    ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (HEAD)                    │ 1393.52ms │
│ Total Time (alamb_test_upgrade_54)   │ 1341.21ms │
│ Average Time (HEAD)                  │   63.34ms │
│ Average Time (alamb_test_upgrade_54) │   60.96ms │
│ Queries Faster                       │        10 │
│ Queries Slower                       │         1 │
│ Queries with No Change               │        11 │
└──────────────────────────────────────┴───────────┘

@xudong963 xudong963 self-requested a review April 9, 2025 14:20
@alamb
Copy link
Contributor Author

alamb commented Apr 10, 2025

I tried briefly to reproduce the performance improvements reported above and it seems like I can:

q14.sql.txt

andrewlamb@Andrews-MacBook-Pro-2:~/Downloads$ for i in `seq 1 5`; do datafusion-cli -f q14.sql  ; done  | grep seconds
Elapsed 0.374 seconds.
Elapsed 0.386 seconds.
Elapsed 0.378 seconds.
Elapsed 0.366 seconds.
Elapsed 0.366 seconds.
andrewlamb@Andrews-MacBook-Pro-2:~/Downloads$ for i in `seq 1 5`; do ./datafusion-cli-alamb_test_upgrade_54 -f q14.sql  ; done  | grep seconds
Elapsed 0.384 seconds.
Elapsed 0.368 seconds.
Elapsed 0.356 seconds.
Elapsed 0.373 seconds.
Elapsed 0.377 seconds.

I poked around and I can't quite figure out if the improvement is related to concat batches or maybe reducing the number of IOs for reading the parquet metadata 🤔

@mbutrovich
Copy link
Contributor

Still seeing if this is just noise, but here are flame graphs for Q14 from my machine if anyone else wants to stare at them:

This PR:
pr

main:
main

@alamb alamb changed the title (WIP) Upgrade to arrow/parquet 55 Upgrade to arrow/parquet 55 Apr 11, 2025
@alamb
Copy link
Contributor Author

alamb commented Apr 11, 2025

Still seeing if this is just noise, but here are flame graphs for Q14 from my machine if anyone else wants to stare at them:

My theory is that the improvement is due to @rluvaton 's PR to improve concat

I thought it might be related to improved pre-fetching / fewer IOs due to

However, I tried an experiment on main to reduce IO and it doesn't seem to have changed anything

@alamb alamb marked this pull request as ready for review April 11, 2025 17:37
@alamb alamb changed the title Upgrade to arrow/parquet 55 Upgrade to arrow/parquet 55, and object_store to 0.12.0 and pyo3 to 0.24.0 Apr 11, 2025
@mbutrovich
Copy link
Contributor

I thought it might be related to improved pre-fetching / fewer IOs due to

This should be easy to confirm with dtruss/dtrace/bpftrace. Let me see if I find a moment.

Copy link
Contributor

@jayzhan211 jayzhan211 left a comment

Choose a reason for hiding this comment

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

👍🏻

@rluvaton
Copy link
Contributor

Happy to improve performance 😄 I got more in my chamber

Copy link
Member

@xudong963 xudong963 left a comment

Choose a reason for hiding this comment

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

LGTM

@alamb alamb merged commit b717723 into apache:main Apr 14, 2025
30 checks passed
@alamb alamb deleted the alamb/test_upgrade_54 branch April 14, 2025 10:43
@alamb
Copy link
Contributor Author

alamb commented Apr 14, 2025

Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Related to common crate core Core DataFusion crate datasource Changes to the datasource crate execution Related to the execution crate functions Changes to functions implementation proto Related to proto crate sqllogictest SQL Logic Tests (.slt) substrait Changes to the substrait crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants