This is an automated email from the ASF dual-hosted git repository.
yuxia pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fluss-rust.git
The following commit(s) were added to refs/heads/main by this push:
new 9054401 chore: upgrade opendal and adopt jiff (#95)
9054401 is described below
commit 905440167ccac5e0537fcd5375d9d9a7d99f9fd0
Author: tison <[email protected]>
AuthorDate: Mon Dec 15 10:41:45 2025 +0800
chore: upgrade opendal and adopt jiff (#95)
Signed-off-by: tison <[email protected]>
---
Cargo.toml | 4 +---
bindings/python/Cargo.toml | 3 +--
bindings/python/src/lib.rs | 5 +++--
crates/fluss/Cargo.toml | 13 +++++------
crates/fluss/{src => }/build.rs | 0
crates/fluss/src/io/file_io.rs | 6 +++---
crates/fluss/src/row/datum.rs | 25 +++++++++++-----------
crates/fluss/tests/integration/admin.rs | 7 +++---
crates/fluss/tests/integration/table.rs | 6 +++---
.../fluss/tests/integration/table_remote_scan.rs | 6 +++---
10 files changed, 37 insertions(+), 38 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index b4ac03b..284a836 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,13 +19,11 @@
categories = ["command-line-utilities"]
description = "The rust implementation of fluss"
repository = "https://github.com/apache/fluss-rust"
-name = "fluss"
edition = "2024"
version = "0.1.0"
license = "Apache-2.0"
rust-version = "1.85"
-
[workspace]
resolver = "2"
members = ["crates/fluss", "crates/examples", "bindings/python",
"bindings/cpp"]
@@ -35,4 +33,4 @@ fluss = { version = "0.1.0", path = "./crates/fluss" }
tokio = { version = "1.44.2", features = ["full"] }
clap = { version = "4.5.37", features = ["derive"] }
arrow = { version = "57.0.0", features = ["ipc_compression"] }
-chrono = { version = "0.4", features = ["clock", "std", "wasmbind"] }
+jiff = { version = "0.2" }
diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml
index 9ecc629..4da8bf8 100644
--- a/bindings/python/Cargo.toml
+++ b/bindings/python/Cargo.toml
@@ -35,5 +35,4 @@ arrow-pyarrow = "57.0.0"
arrow-schema = "57.0.0"
arrow-array = "57.0.0"
pyo3-async-runtimes = { version = "0.26.0", features = ["tokio-runtime"] }
-chrono = { workspace = true }
-once_cell = "1.21.3"
+jiff = { workspace = true }
diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs
index 63e84b1..49d5179 100644
--- a/bindings/python/src/lib.rs
+++ b/bindings/python/src/lib.rs
@@ -15,8 +15,9 @@
// specific language governing permissions and limitations
// under the License.
+use std::sync::LazyLock;
+
pub use ::fluss as fcore;
-use once_cell::sync::Lazy;
use pyo3::prelude::*;
use tokio::runtime::Runtime;
@@ -36,7 +37,7 @@ pub use metadata::*;
pub use table::*;
pub use utils::*;
-static TOKIO_RUNTIME: Lazy<Runtime> = Lazy::new(|| {
+static TOKIO_RUNTIME: LazyLock<Runtime> = LazyLock::new(|| {
tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
diff --git a/crates/fluss/Cargo.toml b/crates/fluss/Cargo.toml
index 4547b9c..54235c4 100644
--- a/crates/fluss/Cargo.toml
+++ b/crates/fluss/Cargo.toml
@@ -20,7 +20,6 @@ edition = { workspace = true }
rust-version = { workspace = true }
version = { workspace = true }
name = "fluss"
-build = "src/build.rs"
[features]
default = ["storage-memory", "storage-fs"]
@@ -52,18 +51,20 @@ rust_decimal = "1"
ordered-float = { version = "4", features = ["serde"] }
parse-display = "0.10"
ref-cast = "1.0"
-chrono = { workspace = true }
-opendal = "0.53.3"
+jiff = { workspace = true }
+opendal = "0.55.0"
url = "2.5.7"
async-trait = "0.1.89"
uuid = { version = "1.10", features = ["v4"] }
-tempfile= "3.23.0"
+tempfile = "3.23.0"
+
+[target.'cfg(target_arch = "wasm32")'.dependencies]
+jiff = { workspace = true, features = ["js"] }
[dev-dependencies]
testcontainers = "0.25.0"
-once_cell = "1.19"
test-env-helpers = "0.2.2"
[build-dependencies]
-prost-build = { version = "0.13.5" }
+prost-build = { version = "0.13.5" }
diff --git a/crates/fluss/src/build.rs b/crates/fluss/build.rs
similarity index 100%
rename from crates/fluss/src/build.rs
rename to crates/fluss/build.rs
diff --git a/crates/fluss/src/io/file_io.rs b/crates/fluss/src/io/file_io.rs
index 69a4c97..96be06f 100644
--- a/crates/fluss/src/io/file_io.rs
+++ b/crates/fluss/src/io/file_io.rs
@@ -22,7 +22,7 @@ use std::ops::Range;
use std::sync::Arc;
use bytes::Bytes;
-use chrono::{DateTime, Utc};
+use jiff::Timestamp;
use opendal::Operator;
use url::Url;
@@ -132,7 +132,7 @@ impl InputFile {
size: meta.content_length(),
is_dir: meta.is_dir(),
path: self.path.clone(),
- last_modified: meta.last_modified(),
+ last_modified: meta.last_modified().map(Into::into),
})
}
@@ -154,5 +154,5 @@ pub struct FileStatus {
pub size: u64,
pub is_dir: bool,
pub path: String,
- pub last_modified: Option<DateTime<Utc>>,
+ pub last_modified: Option<Timestamp>,
}
diff --git a/crates/fluss/src/row/datum.rs b/crates/fluss/src/row/datum.rs
index 3e48703..6929b57 100644
--- a/crates/fluss/src/row/datum.rs
+++ b/crates/fluss/src/row/datum.rs
@@ -15,15 +15,13 @@
// specific language governing permissions and limitations
// under the License.
-use chrono::Datelike;
-
use crate::error::Error::RowConvertError;
use crate::error::Result;
use arrow::array::{
ArrayBuilder, BinaryBuilder, BooleanBuilder, Float32Builder,
Float64Builder, Int8Builder,
Int16Builder, Int32Builder, Int64Builder, StringBuilder,
};
-use chrono::NaiveDate;
+use jiff::ToSpan;
use ordered_float::OrderedFloat;
use parse_display::Display;
use ref_cast::RefCast;
@@ -35,8 +33,6 @@ use std::ops::Deref;
#[allow(dead_code)]
const THIRTY_YEARS_MICROSECONDS: i64 = 946_684_800_000_000;
-pub const UNIX_EPOCH_DAYS: i32 = 719_163;
-
#[derive(Debug, Clone, Display, PartialEq, Eq, PartialOrd, Ord, Hash,
Serialize)]
pub enum Datum<'a> {
#[display("null")]
@@ -404,6 +400,8 @@ impl From<Vec<u8>> for Blob {
}
}
+const UNIX_EPOCH_DAY: jiff::civil::Date = jiff::civil::date(1970, 1, 1);
+
impl Date {
pub const fn new(inner: i32) -> Self {
Date(inner)
@@ -414,16 +412,17 @@ impl Date {
self.0
}
- pub fn year(&self) -> i32 {
- let date = NaiveDate::from_num_days_from_ce_opt(self.0 +
UNIX_EPOCH_DAYS).unwrap();
+ pub fn year(&self) -> i16 {
+ let date = UNIX_EPOCH_DAY + self.0.days();
date.year()
}
- pub fn month(&self) -> i32 {
- let date = NaiveDate::from_num_days_from_ce_opt(self.0 +
UNIX_EPOCH_DAYS).unwrap();
- date.month() as i32
+ pub fn month(&self) -> i8 {
+ let date = UNIX_EPOCH_DAY + self.0.days();
+ date.month()
}
- pub fn day(&self) -> i32 {
- let date = NaiveDate::from_num_days_from_ce_opt(self.0 +
UNIX_EPOCH_DAYS).unwrap();
- date.day() as i32
+
+ pub fn day(&self) -> i8 {
+ let date = UNIX_EPOCH_DAY + self.0.days();
+ date.day()
}
}
diff --git a/crates/fluss/tests/integration/admin.rs
b/crates/fluss/tests/integration/admin.rs
index c51373d..0086d9c 100644
--- a/crates/fluss/tests/integration/admin.rs
+++ b/crates/fluss/tests/integration/admin.rs
@@ -16,16 +16,17 @@
// under the License.
use crate::integration::fluss_cluster::FlussTestingCluster;
-use once_cell::sync::Lazy;
use parking_lot::RwLock;
+
use std::sync::Arc;
+use std::sync::LazyLock;
#[cfg(test)]
use test_env_helpers::*;
// Module-level shared cluster instance (only for this test file)
-static SHARED_FLUSS_CLUSTER: Lazy<Arc<RwLock<Option<FlussTestingCluster>>>> =
- Lazy::new(|| Arc::new(RwLock::new(None)));
+static SHARED_FLUSS_CLUSTER:
LazyLock<Arc<RwLock<Option<FlussTestingCluster>>>> =
+ LazyLock::new(|| Arc::new(RwLock::new(None)));
#[cfg(test)]
#[before_all]
diff --git a/crates/fluss/tests/integration/table.rs
b/crates/fluss/tests/integration/table.rs
index b23fd79..a058bfe 100644
--- a/crates/fluss/tests/integration/table.rs
+++ b/crates/fluss/tests/integration/table.rs
@@ -16,17 +16,17 @@
* limitations under the License.
*/
-use once_cell::sync::Lazy;
use parking_lot::RwLock;
use std::sync::Arc;
+use std::sync::LazyLock;
use crate::integration::fluss_cluster::FlussTestingCluster;
#[cfg(test)]
use test_env_helpers::*;
// Module-level shared cluster instance (only for this test file)
-static SHARED_FLUSS_CLUSTER: Lazy<Arc<RwLock<Option<FlussTestingCluster>>>> =
- Lazy::new(|| Arc::new(RwLock::new(None)));
+static SHARED_FLUSS_CLUSTER:
LazyLock<Arc<RwLock<Option<FlussTestingCluster>>>> =
+ LazyLock::new(|| Arc::new(RwLock::new(None)));
#[cfg(test)]
#[before_all]
diff --git a/crates/fluss/tests/integration/table_remote_scan.rs
b/crates/fluss/tests/integration/table_remote_scan.rs
index f33d440..f52d526 100644
--- a/crates/fluss/tests/integration/table_remote_scan.rs
+++ b/crates/fluss/tests/integration/table_remote_scan.rs
@@ -16,16 +16,16 @@
* limitations under the License.
*/
use crate::integration::fluss_cluster::FlussTestingCluster;
-use once_cell::sync::Lazy;
use parking_lot::RwLock;
use std::sync::Arc;
+use std::sync::LazyLock;
#[cfg(test)]
use test_env_helpers::*;
// Module-level shared cluster instance (only for this test file)
-static SHARED_FLUSS_CLUSTER: Lazy<Arc<RwLock<Option<FlussTestingCluster>>>> =
- Lazy::new(|| Arc::new(RwLock::new(None)));
+static SHARED_FLUSS_CLUSTER:
LazyLock<Arc<RwLock<Option<FlussTestingCluster>>>> =
+ LazyLock::new(|| Arc::new(RwLock::new(None)));
#[cfg(test)]
#[before_all]