lyang24 opened a new pull request, #9093:
URL: https://github.com/apache/arrow-rs/pull/9093

   # Which issue does this PR close?
   
   
   
   - Closes #9059.
   
   # Rationale for this change
   
   reduce allocation cost mentioned in 
https://github.com/apache/arrow-rs/issues/9059
   
   # What changes are included in this PR?
   
   pre allocate view vectors with size.
   
   # Are these changes tested?
   I did a small benchmark with 
   clickbench query 10 and a smaller set (1%) of clickbench 
[data](https://datasets.clickhouse.com/hits_compatible/athena_partitioned/hits_0.parquet)
   
   download data create query 10
   ```
   CREATE EXTERNAL TABLE hits
   STORED AS PARQUET
   LOCATION '/Users/lanqing/Downloads/hits_0.parquet';
   
   SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE 
"MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
   SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE 
"MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
   SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE 
"MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
   SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE 
"MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
   SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE 
"MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
   SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE 
"MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
   SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE 
"MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
   SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE 
"MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
   SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE 
"MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
   SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE 
"MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
   ```
   
   patching datafusion with local arrow
   ```
    [patch.crates-io]
     arrow-array = { path = "../arrow-rs-patched/arrow-array" }
     arrow-buffer = { path = "../arrow-rs-patched/arrow-buffer" }
     arrow-data = { path = "../arrow-rs-patched/arrow-data" }
     arrow-schema = { path = "../arrow-rs-patched/arrow-schema" }
     parquet = { path = "../arrow-rs-patched/parquet" }
   ```
   
   run benchmark
   ```
     cargo build --profile profiling --bin datafusion-cli
   
     # Run benchmark
     hyperfine --warmup 2 --runs 10 --export-json patched.json \
       "./target/profiling/datafusion-cli --file clickbench_q10.sql"
   ```
   
   results i think there are no regression at least - was hoping someone with 
large internet pipe to bench this on full hits table
   
[baseline.json](https://github.com/user-attachments/files/24414610/baseline.json)
   
[patched.json](https://github.com/user-attachments/files/24414611/patched.json)
   
   ```
   Performance Results (hits_0.parquet - 117MB)
   
     Baseline (no patch):     47.12 ms ± 0.60 ms
     Patched (with_capacity): 46.47 ms ± 2.24 ms
   ```
   
   # Are there any user-facing changes?
   
   no
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to