diff --git a/Cargo.lock b/Cargo.lock index a8798faa..65d61e28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -70,7 +70,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -81,7 +81,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -92,9 +92,9 @@ checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "arrow" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4754a624e5ae42081f464514be454b39711daae0458906dacde5f4c632f33a8" +checksum = "ffaaa3e009861fd829d0a24dd6f115aa8e4634324bb092147d43baafe69ca4a7" dependencies = [ "arrow-arith", "arrow-array", @@ -113,9 +113,9 @@ dependencies = [ [[package]] name = "arrow-arith" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b3141e0ec5145a22d8694ea8b6d6f69305971c4fa1c1a13ef0195aef2d678b" +checksum = "3ac95125e1d71c4a252b5a9c729aef111e80418f08aaa6dbabd1ba66918247fc" dependencies = [ "arrow-array", "arrow-buffer", @@ -127,9 +127,9 @@ dependencies = [ [[package]] name = "arrow-array" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8955af33b25f3b175ee10af580577280b4bd01f7e823d94c7cdef7cf8c9aef" +checksum = "0c60c79628e9a97cb90d7a0dc3e944f216a902f837d4ecabc14d524bddbbc137" dependencies = [ "ahash", "arrow-buffer", @@ -137,7 +137,7 @@ dependencies = [ "arrow-schema", "chrono", "half", - "hashbrown 0.16.1", + "hashbrown 0.17.1", "num-complex", "num-integer", "num-traits", @@ -145,9 +145,9 @@ dependencies = [ [[package]] name = "arrow-buffer" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c697ddca96183182f35b3a18e50b9110b11e916d7b7799cbfd4d34662f2c56c2" +checksum = "6026f638c400e9878c1b1cc05c3cfd46fbf381285916ab408678701c1df46c1a" dependencies = [ "bytes", "half", @@ -157,9 +157,9 @@ dependencies = [ [[package]] name = "arrow-cast" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "646bbb821e86fd57189c10b4fcdaa941deaf4181924917b0daa92735baa6ada5" +checksum = "c82c236c3caf8df5664284f3f1fbe89938852163998c3fdbf37e84ac220445e9" dependencies = [ "arrow-array", "arrow-buffer", @@ -178,9 +178,9 @@ dependencies = [ [[package]] name = "arrow-csv" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da746f4180004e3ce7b83c977daf6394d768332349d3d913998b10a120b790a" +checksum = "12714e5fb7954159af1e26d4e0d37108bcf1a2ad5ee5c5bf02a944d564d588b7" dependencies = [ "arrow-array", "arrow-cast", @@ -193,9 +193,9 @@ dependencies = [ [[package]] name = "arrow-data" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fdd994a9d28e6365aa78e15da3f3950c0fdcea6b963a12fa1c391afb637b304" +checksum = "7bd568aa70c4ec5947027b0d5caee94877433b661a0bb9e8ddceeeb5f0c9b1ab" dependencies = [ "arrow-buffer", "arrow-schema", @@ -206,9 +206,9 @@ dependencies = [ [[package]] name = "arrow-ipc" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf7df950701ab528bf7c0cf7eeadc0445d03ef5d6ffc151eaae6b38a58feff1" +checksum = "e57ee4d470eab1a021bc4b63fa2b2c15d572892bf227b0a982d3b755a6c662b5" dependencies = [ "arrow-array", "arrow-buffer", @@ -222,15 +222,16 @@ dependencies = [ [[package]] name = "arrow-json" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ff8357658bedc49792b13e2e862b80df908171275f8e6e075c460da5ee4bf86" +checksum = "38f47e0e7a284e1f3707a780dc8cd5451b1614e9e398ea2d9ca03c7a2fe9a9ed" dependencies = [ "arrow-array", "arrow-buffer", "arrow-cast", - "arrow-data", + "arrow-ord", "arrow-schema", + "arrow-select", "chrono", "half", "indexmap 2.13.1", @@ -246,9 +247,9 @@ dependencies = [ [[package]] name = "arrow-ord" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d8f1870e03d4cbed632959498bcc84083b5a24bded52905ae1695bd29da45b" +checksum = "a79cf73ad2eba8686ec2aa9bbf8671208e509025f166afc040cedbd94ffe4983" dependencies = [ "arrow-array", "arrow-buffer", @@ -259,9 +260,9 @@ dependencies = [ [[package]] name = "arrow-pyarrow" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d18c442b4c266aaf3d7f7dd40fd7ae058cef7f113b00ff0cd8256e1e218ec544" +checksum = "b9e66bd74e4a47c6df9a2af16d9cca97e37cdfe5b3207d5e3558646e07957a27" dependencies = [ "arrow-array", "arrow-data", @@ -271,9 +272,9 @@ dependencies = [ [[package]] name = "arrow-row" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18228633bad92bff92a95746bbeb16e5fc318e8382b75619dec26db79e4de4c0" +checksum = "cea0f7d8ed6182f14952761e2c0f989852d5aa334fcbc49f73a9f2247c25b879" dependencies = [ "arrow-array", "arrow-buffer", @@ -284,18 +285,18 @@ dependencies = [ [[package]] name = "arrow-schema" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c872d36b7bf2a6a6a2b40de9156265f0242910791db366a2c17476ba8330d68" +checksum = "80b3e786a0dd9103acd583a6fb486dbf2f3268466cc0bd571dcf34cef231c1f1" dependencies = [ "bitflags", ] [[package]] name = "arrow-select" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68bf3e3efbd1278f770d67e5dc410257300b161b93baedb3aae836144edcaf4b" +checksum = "067a67e0361f6c31f4a7248759f36ca4ca71b187a941ed4d49da1c7d3d4db624" dependencies = [ "ahash", "arrow-array", @@ -307,9 +308,9 @@ dependencies = [ [[package]] name = "arrow-string" -version = "57.3.0" +version = "59.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e968097061b3c0e9fe3079cf2e703e487890700546b5b0647f60fca1b5a8d8" +checksum = "99bc95847f3ff62a2b03d6f8ce2e3e78f01362060549a2a311898dd442f6256d" dependencies = [ "arrow-array", "arrow-buffer", @@ -1014,7 +1015,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -1426,6 +1427,12 @@ dependencies = [ "foldhash 0.2.0", ] +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + [[package]] name = "heck" version = "0.5.0" @@ -1768,15 +1775,6 @@ dependencies = [ "serde_core", ] -[[package]] -name = "indoc" -version = "2.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706" -dependencies = [ - "rustversion", -] - [[package]] name = "inventory" version = "0.3.24" @@ -1837,7 +1835,7 @@ dependencies = [ "portable-atomic-util", "serde_core", "wasm-bindgen", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2038,9 +2036,9 @@ checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" [[package]] name = "lz4_flex" -version = "0.12.1" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c23545df7ecf1b16c303910a69b079e8e251d60f7dd2cc9b4177f2afaf1746" +checksum = "7ef0d4ed8669f8f8826eb00dc878084aa8f253506c4fd5e8f58f5bce72ddb97e" dependencies = [ "twox-hash", ] @@ -2067,15 +2065,6 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - [[package]] name = "metrics" version = "0.24.5" @@ -2546,28 +2535,26 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.26.0" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383" +checksum = "cf85e27e86080aafd5a22eae58a162e133a589551542b3e5cee4beb27e54f8e1" dependencies = [ - "indoc", "libc", - "memoffset", "once_cell", "portable-atomic", "pyo3-build-config", "pyo3-ffi", "pyo3-macros", - "unindent", ] [[package]] name = "pyo3-async-runtimes" -version = "0.26.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ee6d4cb3e8d5b925f5cdb38da183e0ff18122eb2048d4041c9e7034d026e23" +checksum = "9e7364a95bf00e8377bbf9b0f09d7ff9715a29d8fcf93b47d1a967363b973178" dependencies = [ - "futures", + "futures-channel", + "futures-util", "once_cell", "pin-project-lite", "pyo3", @@ -2576,9 +2563,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.26.0" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f" +checksum = "8bf94ee265674bf76c09fa430b0e99c26e319c945d96ca0d5a8215f31bf81cf7" dependencies = [ "python3-dll-a", "target-lexicon", @@ -2586,9 +2573,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.26.0" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105" +checksum = "491aa5fc66d8059dd44a75f4580a2962c1862a1c2945359db36f6c2818b748dc" dependencies = [ "libc", "pyo3-build-config", @@ -2596,9 +2583,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.26.0" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded" +checksum = "f5d671734e9d7a43449f8480f8b38115df67bef8d21f76837fa75ee7aaa5e52e" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -2608,9 +2595,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.26.0" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf" +checksum = "22faaa1ce6c430a1f71658760497291065e6450d7b5dc2bcf254d49f66ee700a" dependencies = [ "heck", "proc-macro2", @@ -3036,7 +3023,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3395,7 +3382,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -3589,7 +3576,7 @@ dependencies = [ "getrandom 0.4.2", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3981,12 +3968,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "unindent" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3" - [[package]] name = "untrusted" version = "0.9.0" @@ -4291,7 +4272,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 8f811c82..dc6402d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ members = ["crates/fluss", "crates/fluss-test-cluster", "crates/examples", "bind fluss = { package = "fluss-rs", version = "0.2.0", path = "crates/fluss", features = ["storage-all"] } tokio = { version = "1.44.2", features = ["full"] } clap = { version = "4.5.37", features = ["derive"] } -arrow = { version = "57.0.0", features = ["ipc_compression", "ffi"] } +arrow = { version = "59.0.0", features = ["ipc_compression", "ffi"] } bigdecimal = "0.4" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml index 30ac0469..024fa8ce 100644 --- a/bindings/python/Cargo.toml +++ b/bindings/python/Cargo.toml @@ -27,14 +27,14 @@ name = "fluss" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.26.0", features = ["extension-module", "generate-import-lib"] } +pyo3 = { version = "0.28.0", features = ["extension-module", "generate-import-lib"] } fluss = { workspace = true, features = ["storage-all"] } tokio = { workspace = true } arrow = { workspace = true } -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"] } +arrow-pyarrow = "59.0.0" +arrow-schema = "59.0.0" +arrow-array = "59.0.0" +pyo3-async-runtimes = { version = "0.28.0", features = ["tokio-runtime"] } jiff = { workspace = true } bigdecimal = "0.4" indexmap = "2" diff --git a/bindings/python/src/config.rs b/bindings/python/src/config.rs index 11188bf3..a4688511 100644 --- a/bindings/python/src/config.rs +++ b/bindings/python/src/config.rs @@ -19,7 +19,7 @@ use crate::*; use pyo3::types::PyDict; /// Configuration for Fluss client -#[pyclass] +#[pyclass(from_py_object)] #[derive(Clone)] pub struct Config { inner: fcore::config::Config, diff --git a/bindings/python/src/error.rs b/bindings/python/src/error.rs index 9d718aa6..a9da0376 100644 --- a/bindings/python/src/error.rs +++ b/bindings/python/src/error.rs @@ -26,7 +26,7 @@ use pyo3::prelude::*; const CLIENT_ERROR_CODE: i32 = -2; /// Fluss errors -#[pyclass(extends=PyException)] +#[pyclass(extends=PyException, from_py_object)] #[derive(Debug, Clone)] pub struct FlussError { #[pyo3(get)] diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index 45b5092b..011f0656 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -56,7 +56,7 @@ static TOKIO_RUNTIME: LazyLock = LazyLock::new(|| { /// OffsetSpec.earliest() /// OffsetSpec.latest() /// OffsetSpec.timestamp(ts) -#[pyclass] +#[pyclass(from_py_object)] #[derive(Clone)] pub struct OffsetSpec { pub(crate) inner: fcore::rpc::message::OffsetSpec, diff --git a/bindings/python/src/metadata.rs b/bindings/python/src/metadata.rs index 7b6129a4..c4346549 100644 --- a/bindings/python/src/metadata.rs +++ b/bindings/python/src/metadata.rs @@ -20,7 +20,7 @@ use pyo3::types::PyDict; use std::collections::HashMap; /// Represents the type of change for a record in a log -#[pyclass(eq, eq_int)] +#[pyclass(eq, eq_int, from_py_object)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ChangeType { /// Append-only operation @@ -71,7 +71,7 @@ impl ChangeType { } /// Represents a table path with database and table name -#[pyclass] +#[pyclass(from_py_object)] #[derive(Clone)] pub struct TablePath { database_name: String, @@ -260,7 +260,7 @@ impl TableDistribution { } /// Table descriptor containing schema and metadata -#[pyclass] +#[pyclass(from_py_object)] #[derive(Clone)] pub struct TableDescriptor { __tbl_desc: fcore::metadata::TableDescriptor, @@ -363,7 +363,7 @@ impl TableDescriptor { } /// Information about a Fluss table -#[pyclass] +#[pyclass(from_py_object)] #[derive(Clone)] pub struct TableInfo { __table_info: fcore::metadata::TableInfo, @@ -479,7 +479,7 @@ impl TableInfo { } /// Represents a lake snapshot with snapshot ID and table bucket offsets -#[pyclass] +#[pyclass(from_py_object)] #[derive(Clone)] pub struct LakeSnapshot { snapshot_id: i64, @@ -487,7 +487,7 @@ pub struct LakeSnapshot { } /// Represents a table bucket with table ID, partition ID, and bucket ID -#[pyclass] +#[pyclass(from_py_object)] #[derive(Eq, Hash, PartialEq, Clone)] pub struct TableBucket { table_id: i64, @@ -665,7 +665,7 @@ impl LakeSnapshot { } /// Descriptor for a Fluss database (comment and custom properties) -#[pyclass] +#[pyclass(from_py_object)] #[derive(Clone)] pub struct DatabaseDescriptor { __descriptor: fcore::metadata::DatabaseDescriptor, diff --git a/bindings/python/src/table.rs b/bindings/python/src/table.rs index cbdcbc01..521a9b3a 100644 --- a/bindings/python/src/table.rs +++ b/bindings/python/src/table.rs @@ -238,7 +238,7 @@ impl ScanRecords { )); } // Try slice - if let Ok(slice) = key.downcast::() { + if let Ok(slice) = key.cast::() { let indices = slice.indices(self.total_count as isize)?; let mut result: Vec> = Vec::new(); let mut i = indices.start; @@ -1364,11 +1364,11 @@ fn python_value_to_datum(value: &Bound, data_type: &DataType) -> PyResult Ok(v.into()) } DataType::Bytes(_) | DataType::Binary(_) => { - // Efficient extraction: downcast to specific type and use bulk copy. + // Efficient extraction: cast to specific type and use bulk copy. // PyBytes::as_bytes() and PyByteArray::to_vec() are O(n) bulk copies of the underlying data. - if let Ok(bytes) = value.downcast::() { + if let Ok(bytes) = value.cast::() { Ok(bytes.as_bytes().to_vec().into()) - } else if let Ok(bytearray) = value.downcast::() { + } else if let Ok(bytearray) = value.cast::() { Ok(bytearray.to_vec().into()) } else { Err(FlussError::new_err(format!( @@ -1392,7 +1392,7 @@ fn python_value_to_datum(value: &Bound, data_type: &DataType) -> PyResult get_type_name(value) ))); } - let seq = value.downcast::().map_err(|_| { + let seq = value.cast::().map_err(|_| { FlussError::new_err(format!( "Expected sequence for Array column, got {}", get_type_name(value) @@ -1480,7 +1480,7 @@ fn python_value_to_datum(value: &Bound, data_type: &DataType) -> PyResult fn python_map_pairs<'py>( value: &Bound<'py, PyAny>, ) -> PyResult, Bound<'py, PyAny>)>> { - if let Ok(dict) = value.downcast::() { + if let Ok(dict) = value.cast::() { return Ok(dict.iter().collect()); } if value.is_instance_of::() { @@ -1489,7 +1489,7 @@ fn python_map_pairs<'py>( get_type_name(value) ))); } - let seq = value.downcast::().map_err(|_| { + let seq = value.cast::().map_err(|_| { FlussError::new_err(format!( "Expected dict or sequence of (key, value) pairs for Map column, got {}", get_type_name(value) @@ -1499,7 +1499,7 @@ fn python_map_pairs<'py>( let mut pairs = Vec::with_capacity(len); for i in 0..len { let entry = seq.get_item(i)?; - let pair = entry.downcast::().map_err(|_| { + let pair = entry.cast::().map_err(|_| { FlussError::new_err("Map entries must be (key, value) pairs".to_string()) })?; if pair.len()? != 2 { @@ -1941,7 +1941,7 @@ static UTC_EPOCH: PyOnceLock> = PyOnceLock::new(); fn get_decimal_type(py: Python) -> PyResult> { let ty = DECIMAL_TYPE.get_or_try_init(py, || -> PyResult<_> { let decimal_mod = py.import("decimal")?; - let decimal_ty = decimal_mod.getattr("Decimal")?.downcast_into::()?; + let decimal_ty = decimal_mod.getattr("Decimal")?.cast_into::()?; Ok(decimal_ty.unbind()) })?; Ok(ty.bind(py).clone()) @@ -1955,8 +1955,8 @@ fn get_utc_timezone(py: Python) -> PyResult> { let utc = timezone.getattr("utc")?; Ok(utc.unbind()) })?; - // Downcast to PyTzInfo for use with PyDateTime::new() - Ok(tz.bind(py).clone().downcast_into::()?) + // Cast to PyTzInfo for use with PyDateTime::new() + Ok(tz.bind(py).clone().cast_into::()?) } /// Get the cached UTC epoch datetime, creating it once per interpreter. @@ -2013,13 +2013,13 @@ fn python_decimal_to_datum( /// Convert Python datetime.date to Datum::Date. fn python_date_to_datum(value: &Bound) -> PyResult> { // Reject datetime.datetime (subclass of date) - use timestamp columns for those - if value.downcast::().is_ok() { + if value.cast::().is_ok() { return Err(FlussError::new_err( "Expected datetime.date, got datetime.datetime. Use a TIMESTAMP column for datetime values.", )); } - let date = value.downcast::().map_err(|_| { + let date = value.cast::().map_err(|_| { FlussError::new_err(format!( "Expected datetime.date, got {}", get_type_name(value) @@ -2048,7 +2048,7 @@ fn python_date_to_datum(value: &Bound) -> PyResult) -> PyResult> { - let time = value.downcast::().map_err(|_| { + let time = value.cast::().map_err(|_| { FlussError::new_err(format!( "Expected datetime.time, got {}", get_type_name(value) @@ -2107,7 +2107,7 @@ fn python_datetime_to_timestamp_ltz(value: &Bound) -> PyResult) -> PyResult<(i64, i32)> { // Try PyDateTime first - if let Ok(dt) = value.downcast::() { + if let Ok(dt) = value.cast::() { // Reject tz-aware datetime for NTZ - it's ambiguous what the user wants let tzinfo = dt.getattr("tzinfo")?; if !tzinfo.is_none() { @@ -2137,7 +2137,7 @@ fn extract_datetime_components_ntz(value: &Bound) -> PyResult<(i64, i32)> // Try to_pydatetime() for objects that support it if let Ok(py_dt) = value.call_method0("to_pydatetime") { - if let Ok(dt) = py_dt.downcast::() { + if let Ok(dt) = py_dt.cast::() { let tzinfo = dt.getattr("tzinfo")?; if !tzinfo.is_none() { return Err(FlussError::new_err( @@ -2159,7 +2159,7 @@ fn extract_datetime_components_ntz(value: &Bound) -> PyResult<(i64, i32)> /// For naive datetimes, assumes UTC. For aware datetimes, converts to UTC. fn extract_datetime_components_ltz(value: &Bound) -> PyResult<(i64, i32)> { // Try PyDateTime first - if let Ok(dt) = value.downcast::() { + if let Ok(dt) = value.cast::() { // Check if timezone-aware let tzinfo = dt.getattr("tzinfo")?; if tzinfo.is_none() { @@ -2180,7 +2180,7 @@ fn extract_datetime_components_ltz(value: &Bound) -> PyResult<(i64, i32)> // Try to_pydatetime() if let Ok(py_dt) = value.call_method0("to_pydatetime") { - if let Ok(dt) = py_dt.downcast::() { + if let Ok(dt) = py_dt.cast::() { let tzinfo = dt.getattr("tzinfo")?; if tzinfo.is_none() { return datetime_to_epoch_millis_as_utc(dt); @@ -2234,7 +2234,7 @@ fn datetime_to_epoch_millis_utc_aware(dt: &Bound<'_, PyDateTime>) -> PyResult<(i // Compute delta = dt - epoch (this handles timezone conversion correctly) let delta = dt.call_method1("__sub__", (epoch,))?; - let delta = delta.downcast::()?; + let delta = delta.cast::()?; // Extract components using integer arithmetic let days = delta.get_days() as i64; diff --git a/crates/fluss/Cargo.toml b/crates/fluss/Cargo.toml index 821ee52e..d4f7ec60 100644 --- a/crates/fluss/Cargo.toml +++ b/crates/fluss/Cargo.toml @@ -44,7 +44,7 @@ integration_tests = [] [dependencies] arrow = { workspace = true } -arrow-schema = "57.0.0" +arrow-schema = "59.0.0" bitvec = "1" byteorder = "1.5" futures = "0.3"