This is an automated email from the ASF dual-hosted git repository.

tisonkun pushed a commit to branch tidytidy
in repository https://gitbox.apache.org/repos/asf/datasketches-rust.git

commit 127f2be33418e980367acd3c73a1b2d2ae6140e0
Author: tison <[email protected]>
AuthorDate: Fri Jul 24 23:30:40 2026 +0800

    fixup scripts
    
    Signed-off-by: tison <[email protected]>
---
 .github/workflows/ci.yml                           |  2 +-
 CONTRIBUTING.md                                    |  6 ++--
 datasketches/tests/common.rs                       |  4 +--
 datasketches/tests/tuple_serialization_test.rs     | 15 ----------
 datasketches/tests/tuple_sketch_test.rs            |  5 ----
 ...data.py => download_serialization_test_data.py} | 34 +++++++++-------------
 6 files changed, 19 insertions(+), 47 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index aafd7ba..fcae649 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -93,7 +93,7 @@ jobs:
           cache-bin: "false"
       - name: Prepare test data
         shell: bash
-        run: ./tools/generate_serialization_test_data.py
+        run: ./tools/download_serialization_test_data.py
       - name: Run unit tests
         shell: bash
         run: cargo x test
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4184e90..a5fe069 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -88,7 +88,7 @@ cargo install taplo-cli typos-cli hawkeye
 Some tests depend on snapshot files under 
`datasketches/tests/serialization_test_data`. If they are missing, tests will 
fail. Download them with:
 
 ```shell
-python3 ./tools/generate_serialization_test_data.py --all
+python3 ./tools/download_serialization_test_data.py --all
 ```
 
 The script downloads the latest snapshots from the `main` branch of
@@ -100,8 +100,8 @@ The script downloads the latest snapshots from the `main` 
branch of
 You can download them separately:
 
 ```shell
-python3 ./tools/generate_serialization_test_data.py --java
-python3 ./tools/generate_serialization_test_data.py --cpp
+python3 ./tools/download_serialization_test_data.py --java
+python3 ./tools/download_serialization_test_data.py --cpp
 ```
 
 The script requires Python 3 and network access.
diff --git a/datasketches/tests/common.rs b/datasketches/tests/common.rs
index e97b920..ca26fe6 100644
--- a/datasketches/tests/common.rs
+++ b/datasketches/tests/common.rs
@@ -39,10 +39,10 @@ pub fn serialization_test_data(sub_dir: &str, name: &str) 
-> PathBuf {
             r#"serialization test data file not found: {}
 
             Please ensure test data files are present in the repository. 
Generally, you can
-            run the following commands from the project root to regenerate the 
test data files
+            run the following commands from the project root to download the 
test data files
             if they are missing:
 
-            $ ./tools/generate_serialization_test_data.py
+            $ ./tools/download_serialization_test_data.py
         "#,
             path.display(),
         );
diff --git a/datasketches/tests/tuple_serialization_test.rs 
b/datasketches/tests/tuple_serialization_test.rs
index ae692ee..1de5f1e 100644
--- a/datasketches/tests/tuple_serialization_test.rs
+++ b/datasketches/tests/tuple_serialization_test.rs
@@ -15,21 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-//! Cross-language compatibility tests for Tuple sketch serialization.
-//!
-//! The fixtures are produced by the upstream Java and C++ generators (see
-//! `tools/generate_serialization_test_data.py`):
-//!
-//! * Java: `TupleCrossLanguageTest.generateForCppIntegerSummary` writes 
`tuple_int_n{n}_java.sk`
-//!   using its `IntegerSummary`.
-//! * C++: `tuple_sketch_serialize_for_java.cpp` writes 
`tuple_int_n{n}_cpp.sk` using an `int`
-//!   summary.
-//!
-//! Both build a tuple sketch with `update(i, i)` for `i` in `0..n`, so the 
summary is a 4-byte
-//! little-endian signed integer — exactly what the `i32` 
[`TupleSummaryValue`] implementation
-//! reads. The `aod_*`/`aos_*` fixtures use Array-of-Doubles / 
Array-of-Strings summaries, which
-//! this crate does not implement, so they are intentionally not covered here.
-
 #![cfg(feature = "tuple")]
 
 mod common;
diff --git a/datasketches/tests/tuple_sketch_test.rs 
b/datasketches/tests/tuple_sketch_test.rs
index e80b155..fb5468e 100644
--- a/datasketches/tests/tuple_sketch_test.rs
+++ b/datasketches/tests/tuple_sketch_test.rs
@@ -15,11 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-//! Behavioral tests for the Tuple sketch, mirroring `theta_sketch_test.rs`.
-//!
-//! Updates carry a `u64` summary combined with the default (additive) policy, 
so the distinct-count
-//! behavior matches the Theta sketch while the summaries accumulate alongside 
each key.
-
 #![cfg(feature = "tuple")]
 
 use datasketches::common::NumStdDev;
diff --git a/tools/generate_serialization_test_data.py 
b/tools/download_serialization_test_data.py
similarity index 79%
rename from tools/generate_serialization_test_data.py
rename to tools/download_serialization_test_data.py
index 2e9ba20..1b0aca0 100755
--- a/tools/generate_serialization_test_data.py
+++ b/tools/download_serialization_test_data.py
@@ -26,9 +26,7 @@ import urllib.request
 import zipfile
 from pathlib import Path, PurePosixPath
 
-TCK_ARCHIVE_URL = (
-    "https://github.com/apache/datasketches-tck/archive/refs/heads/main.zip";
-)
+TCK_ARCHIVE_URL = 
"https://github.com/apache/datasketches-tck/archive/0016a517/main.zip";
 OUTPUT_DIRS = {
     "java": "java_generated_files",
     "cpp": "cpp_generated_files",
@@ -37,16 +35,13 @@ OUTPUT_DIRS = {
 
 def download_archive(destination):
     print(f"Downloading serialization snapshots from {TCK_ARCHIVE_URL}", 
flush=True)
-    request = urllib.request.Request(
-        TCK_ARCHIVE_URL,
-        headers={"User-Agent": "apache-datasketches-rust"},
-    )
+    request = urllib.request.Request(TCK_ARCHIVE_URL)
     with urllib.request.urlopen(request, timeout=60) as response:
         with destination.open("wb") as output:
             shutil.copyfileobj(response, output)
 
 
-def install_snapshots(archive, project_dir, language):
+def extract_snapshots(archive, project_dir, language):
     source_parts = ("serialization", language, "snapshots")
     members = []
 
@@ -95,7 +90,7 @@ def install_snapshots(archive, project_dir, language):
             if temp_path is not None and temp_path.exists():
                 temp_path.unlink()
 
-    print(f"Installed {len(members)} {language} snapshots into {output_dir}")
+    print(f"Extracted {len(members)} {language} snapshots into {output_dir}")
 
 
 def main():
@@ -115,18 +110,15 @@ def main():
     if not languages:
         languages = list(OUTPUT_DIRS)
 
-    project_dir = Path(__file__).resolve().parent.parent / "datasketches"
-
-    try:
-        with tempfile.TemporaryDirectory(prefix="datasketches-tck-") as 
temp_dir:
-            archive_path = Path(temp_dir) / "datasketches-tck.zip"
-            download_archive(archive_path)
-            with zipfile.ZipFile(archive_path) as archive:
-                for language in languages:
-                    install_snapshots(archive, project_dir, language)
-    except (OSError, RuntimeError, urllib.error.URLError, zipfile.BadZipFile) 
as error:
-        print(f"Error: {error}", file=sys.stderr)
-        return 1
+    repository_root = Path(__file__).resolve().parents[2]
+    project_dir = repository_root / "datasketches"
+
+    with tempfile.TemporaryDirectory(prefix="datasketches-tck-") as temp_dir:
+        archive_path = Path(temp_dir) / "datasketches-tck.zip"
+        download_archive(archive_path)
+        with zipfile.ZipFile(archive_path) as archive:
+            for language in languages:
+                extract_snapshots(archive, project_dir, language)
 
     return 0
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to