From 70560f66bb90fc35930c52a28c09f4fff62de161 Mon Sep 17 00:00:00 2001 From: gsilvestrin Date: Wed, 8 Mar 2023 14:23:12 -0800 Subject: [PATCH] Sorting dataset versions (#668) * Sorting dataset versions * fixed test --- python/python/tests/test_dataset.py | 2 +- rust/src/dataset.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/python/python/tests/test_dataset.py b/python/python/tests/test_dataset.py index 992f478d1d..593bf85260 100644 --- a/python/python/tests/test_dataset.py +++ b/python/python/tests/test_dataset.py @@ -52,7 +52,7 @@ def test_versions(tmp_path: Path): assert len(lance.dataset(base_dir).versions()) == 2 - v2, v1 = lance.dataset(base_dir).versions() + v1, v2 = lance.dataset(base_dir).versions() assert v1["version"] == 1 assert v2["version"] == 2 assert isinstance(v1["timestamp"], datetime) diff --git a/rust/src/dataset.rs b/rust/src/dataset.rs index fe02a37a87..9d841d5ab8 100644 --- a/rust/src/dataset.rs +++ b/rust/src/dataset.rs @@ -570,6 +570,7 @@ impl Dataset { let manifest = read_manifest(&self.object_store, path).await?; versions.push(Version::from(&manifest)); } + versions.sort_by_key(|v| v.version); Ok(versions) }