This is an automated email from the ASF dual-hosted git repository.
psiace pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datasketches-rust.git
The following commit(s) were added to refs/heads/main by this push:
new 6dbe414 chore: remove incomplete examples module (#112) (#114)
6dbe414 is described below
commit 6dbe4146591c3cf83e5f94f72fbec5884de11057
Author: Cancai Cai <[email protected]>
AuthorDate: Fri Apr 10 23:56:42 2026 +0800
chore: remove incomplete examples module (#112) (#114)
The examples module was incomplete and not present in other DataSketches
dialect libraries. Basic usage examples are better served by rustdoc
examples directly in the code.
---
.github/workflows/ci.yml | 13 --------
Cargo.toml | 2 +-
examples/Cargo.toml | 40 -------------------------
examples/src/hll_update.rs | 70 --------------------------------------------
examples/src/theta_sketch.rs | 49 -------------------------------
5 files changed, 1 insertion(+), 173 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 02ffb73..87878f8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -85,19 +85,6 @@ jobs:
run: |
rustup toolchain install ${{ matrix.rust-version }}
rustup default ${{ matrix.rust-version }}
- - name: Run examples
- shell: bash
- working-directory: examples
- run: |
- set -x
- METADATA=$( cargo metadata --format-version=1 --no-deps )
- EXAMPLES=$( echo "$METADATA" | jq -r '.packages[] | select(.name ==
"examples") | .targets[].name' | tr -d '\r' )
- while read -r example; do
- if [ -n "$example" ]; then
- echo "Running example: $example"
- cargo run --bin "$example"
- fi
- done <<< "$EXAMPLES"
- name: Setup Java
uses: actions/setup-java@v5
with:
diff --git a/Cargo.toml b/Cargo.toml
index cc776fe..38d8511 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,7 @@
# under the License.
[workspace]
-members = ["datasketches", "examples", "xtask"]
+members = ["datasketches", "xtask"]
resolver = "3"
[workspace.package]
diff --git a/examples/Cargo.toml b/examples/Cargo.toml
deleted file mode 100644
index f79a9f4..0000000
--- a/examples/Cargo.toml
+++ /dev/null
@@ -1,40 +0,0 @@
-# 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.
-
-[package]
-name = "examples"
-publish = false
-
-edition.workspace = true
-rust-version.workspace = true
-
-[[bin]]
-name = "hll_update"
-path = "src/hll_update.rs"
-
-[[bin]]
-name = "theta_sketch"
-path = "src/theta_sketch.rs"
-
-[package.metadata.release]
-release = false
-
-[dependencies]
-datasketches = { workspace = true }
-
-[lints]
-workspace = true
diff --git a/examples/src/hll_update.rs b/examples/src/hll_update.rs
deleted file mode 100644
index 2ea346f..0000000
--- a/examples/src/hll_update.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-// 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 datasketches::hll::HllSketch;
-use datasketches::hll::HllType;
-
-fn main() {
- // Create a new HLL sketch
- // lg_k=12 means 4096 buckets, ~1.6% relative error
- let mut sketch = HllSketch::new(12, HllType::Hll8);
-
- println!("Created HLL sketch with lg_k=12 (K=4096)");
- println!("Initial estimate: {}", sketch.estimate());
-
- // Add some values
- println!("\nAdding 10,000 unique integers...");
- for i in 0..10_000 {
- sketch.update(i);
- }
-
- let estimate = sketch.estimate();
- let actual = 10_000;
- let error = ((estimate - actual as f64) / actual as f64 * 100.0).abs();
-
- println!("Actual unique values: {}", actual);
- println!("Estimated unique values: {:.2}", estimate);
- println!("Relative error: {:.2}%", error);
-
- // Test duplicate handling
- println!("\nAdding the same 10,000 values again...");
- for i in 0..10_000 {
- sketch.update(i);
- }
-
- let estimate2 = sketch.estimate();
- println!("Estimate after duplicates: {:.2}", estimate2);
- println!("(Should remain ~10,000, got {:.2})", estimate2);
-
- // Serialize and deserialize
- println!("\nSerializing sketch...");
- let bytes = sketch.serialize();
- println!("Serialized size: {} bytes", bytes.len());
-
- let sketch2 = HllSketch::deserialize(&bytes).unwrap();
- let estimate3 = sketch2.estimate();
- println!("Estimate after deserialization: {:.2}", estimate3);
-
- // Different types
- println!("\nHLL works with any hashable type:");
- let mut multi_sketch = HllSketch::new(10, HllType::Hll6);
- multi_sketch.update("hello");
- multi_sketch.update("world");
- multi_sketch.update(42);
- multi_sketch.update(vec![1, 2, 3]);
- println!("Estimate with mixed types: {:.2}", multi_sketch.estimate());
-}
diff --git a/examples/src/theta_sketch.rs b/examples/src/theta_sketch.rs
deleted file mode 100644
index d76d240..0000000
--- a/examples/src/theta_sketch.rs
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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.
-
-//! Example demonstrating theta sketch usage
-
-use datasketches::theta::ThetaSketch;
-
-fn main() {
- println!("=== Theta Sketch Example ===\n");
-
- // Example 1: Basic usage
- println!("1. Basic Theta Sketch Usage:");
- let mut sketch = ThetaSketch::builder().lg_k(10).build();
-
- for i in 0..100 {
- sketch.update(format!("item_{}", i));
- }
- sketch.update("duplicatee_item");
- sketch.update("duplicatee_item");
-
- println!(" Estimate: {:.2}", sketch.estimate());
- println!(" Theta: {:.6}", sketch.theta());
- println!(" Num retained: {}", sketch.num_retained());
- println!();
-
- // Example 2: Add more data to enter estimation mode
- println!("2. Add more data to enter estimation mode:");
- for i in 0..5000 {
- sketch.update(format!("item_{}", i));
- }
- println!(" Estimate: {:.2}", sketch.estimate());
- println!(" Theta: {:.6}", sketch.theta());
- println!(" Num retained: {}", sketch.num_retained());
- println!();
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]