From 55098596aff17659a20d241c699d61595b510716 Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Fri, 5 Jul 2024 22:19:44 -0400 Subject: [PATCH] Adjust max element counts --- .gitignore | 6 +++--- src/sink.rs | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 00662f0..be1fc42 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,9 @@ target/ # Test outputs out/ -test/*.osm -test/*.pbf -test/parquet/ +*.osm.pbf +*.osm +*.parquet # These are backup files generated by rustfmt **/*.rs.bk diff --git a/src/sink.rs b/src/sink.rs index 1051279..205526a 100644 --- a/src/sink.rs +++ b/src/sink.rs @@ -19,7 +19,8 @@ pub struct ElementSink { } impl ElementSink { - const MAX_ELEMENTS_COUNT: u64 = 1_000_000; + const MAX_NODES_COUNT: u64 = 5_000_000; + const MAX_WAY_RELATION_COUNT: u64 = 500_000; pub fn new( filenum: Arc>, @@ -58,7 +59,8 @@ impl ElementSink { fn increment_and_cycle(&mut self) -> Result<(), std::io::Error> { self.num_elements += 1; - if self.num_elements >= Self::MAX_ELEMENTS_COUNT { + let max_elements = if self.osm_type == OSMType::Node { Self::MAX_NODES_COUNT } else { Self::MAX_WAY_RELATION_COUNT }; + if self.num_elements >= max_elements { self.finish_batch(); } Ok(())