progval commented on code in PR #5860:
URL: https://github.com/apache/arrow-rs/pull/5860#discussion_r1638800259


##########
parquet/examples/write_parquet.rs:
##########
@@ -0,0 +1,71 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fs::File;
+use std::sync::Arc;
+
+use dsi_progress_logger::prelude::*;
+
+use arrow::array::{StructArray, UInt64Builder};
+use arrow::datatypes::DataType::UInt64;
+use arrow::datatypes::{Field, Schema};
+use parquet::arrow::ArrowWriter as ParquetWriter;
+use parquet::basic::Encoding;
+use parquet::errors::Result;
+use parquet::file::properties::WriterProperties;
+
+fn main() -> Result<()> {

Review Comment:
   Done, along with a Clap argument parser:
   
   ```
   $ cargo run --release --features="cli sysinfo" --example write_parquet -- -h
   Writes sequences of integers, with a Bloom Filter, while logging timing and 
memory usage
   
   Usage: write_parquet [OPTIONS] <PATH>
   
   Arguments:
     <PATH>  Path to the file to write
   
   Options:
         --iterations <ITERATIONS>                        Number of batches to 
write [default: 1000]
         --batch <BATCH>                                  Number of rows in 
each batch [default: 1000000]
         --bloom-filter-position <BLOOM_FILTER_POSITION>  Where to write Bloom 
Filters [default: after-row-group] [possible values: end, after-row-group]
     -h, --help                                           Print help
     -V, --version                                        Print version
   ```



##########
parquet/Cargo.toml:
##########
@@ -68,6 +68,9 @@ twox-hash = { version = "1.6", default-features = false }
 paste = { version = "1.0" }
 half = { version = "2.1", default-features = false, features = ["num-traits"] }
 
+dsi-progress-logger = { version = "0.2.4", optional = true }

Review Comment:
   Done. It now looks like this:
   
   ```
   $ cargo run --release --features="cli sysinfo" --example write_parquet -- 
/tmp/test.parquet
   2024-06-13 21:45:40 Writing 1000 batches of 1000000 rows. RSS = 1MB
   2024-06-13 21:45:50 Iteration 260/1000. RSS = 50MB
   2024-06-13 21:46:00 Iteration 518/1000. RSS = 50MB
   2024-06-13 21:46:10 Iteration 772/1000. RSS = 50MB
   2024-06-13 21:46:19 Done. RSS = 17MB
   
   $ cargo run --release --features="cli sysinfo" --example write_parquet -- 
/tmp/test.parquet --bloom-filter-position end
   2024-06-13 21:46:29 Writing 1000 batches of 1000000 rows. RSS = 1MB
   2024-06-13 21:46:39 Iteration 267/1000. RSS = 451MB
   2024-06-13 21:46:49 Iteration 533/1000. RSS = 791MB
   2024-06-13 21:46:59 Iteration 799/1000. RSS = 1151MB
   2024-06-13 21:47:07 Done. RSS = 1055MB
   ```



-- 
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