diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index e015acdb0dad6..37f8f8a525407 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -46,7 +46,6 @@ jobs: with: tool: cargo-audit - name: Run audit check - # RUSTSEC-2026-0001: https://rustsec.org/advisories/RUSTSEC-2026-0001.html - # underlying rkyv is patched, but rustsec database not yet updated - # Can remove when this is merged: https://github.com/rustsec/advisory-db/pull/2565 - run: cargo audit --ignore RUSTSEC-2026-0001 + # Note: you can ignore specific RUSTSEC issues using the `--ignore` flag ,for example: + # run: cargo audit --ignore RUSTSEC-2026-0001 + run: cargo audit diff --git a/Cargo.lock b/Cargo.lock index b0c26e27b426b..397d933a00f36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,17 +56,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" -[[package]] -name = "ahash" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" -dependencies = [ - "getrandom 0.2.16", - "once_cell", - "version_check", -] - [[package]] name = "ahash" version = "0.8.12" @@ -284,7 +273,7 @@ version = "57.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a23eaff85a44e9fa914660fb0d0bb00b79c4a3d888b5334adb3ea4330c84f002" dependencies = [ - "ahash 0.8.12", + "ahash", "arrow-buffer", "arrow-data", "arrow-schema", @@ -471,7 +460,7 @@ version = "57.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae980d021879ea119dd6e2a13912d81e64abed372d53163e804dfe84639d8010" dependencies = [ - "ahash 0.8.12", + "ahash", "arrow-array", "arrow-buffer", "arrow-data", @@ -554,7 +543,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -576,7 +565,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -587,7 +576,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -1044,18 +1033,6 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - [[package]] name = "blake2" version = "0.10.6" @@ -1186,30 +1163,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.113", -] - -[[package]] -name = "borsh" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1da5ab77c1437701eeff7c88d968729e7766172279eab0676857b3d63af7a6f" -dependencies = [ - "borsh-derive", - "cfg_aliases", -] - -[[package]] -name = "borsh-derive" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0686c856aa6aac0c4498f936d7d6a02df690f614c03e4d906d1018062b5c5e2c" -dependencies = [ - "once_cell", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -1249,28 +1203,6 @@ version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" -[[package]] -name = "bytecheck" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" -dependencies = [ - "bytecheck_derive", - "ptr_meta", - "simdutf8", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "byteorder" version = "1.5.0" @@ -1414,7 +1346,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -1748,7 +1680,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -1759,7 +1691,7 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -1953,7 +1885,7 @@ dependencies = [ name = "datafusion-common" version = "51.0.0" dependencies = [ - "ahash 0.8.12", + "ahash", "apache-avro", "arrow", "arrow-ipc", @@ -2302,7 +2234,7 @@ dependencies = [ name = "datafusion-functions-aggregate" version = "51.0.0" dependencies = [ - "ahash 0.8.12", + "ahash", "arrow", "criterion", "datafusion-common", @@ -2323,7 +2255,7 @@ dependencies = [ name = "datafusion-functions-aggregate-common" version = "51.0.0" dependencies = [ - "ahash 0.8.12", + "ahash", "arrow", "criterion", "datafusion-common", @@ -2399,7 +2331,7 @@ version = "51.0.0" dependencies = [ "datafusion-doc", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -2433,7 +2365,7 @@ dependencies = [ name = "datafusion-physical-expr" version = "51.0.0" dependencies = [ - "ahash 0.8.12", + "ahash", "arrow", "criterion", "datafusion-common", @@ -2473,7 +2405,7 @@ dependencies = [ name = "datafusion-physical-expr-common" version = "51.0.0" dependencies = [ - "ahash 0.8.12", + "ahash", "arrow", "chrono", "datafusion-common", @@ -2508,7 +2440,7 @@ dependencies = [ name = "datafusion-physical-plan" version = "51.0.0" dependencies = [ - "ahash 0.8.12", + "ahash", "arrow", "arrow-ord", "arrow-schema", @@ -2687,10 +2619,8 @@ dependencies = [ "itertools 0.14.0", "log", "object_store", - "postgres-protocol", "postgres-types", "regex", - "rust_decimal", "sqllogictest", "sqlparser", "tempfile", @@ -2799,7 +2729,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -2855,7 +2785,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -2893,7 +2823,7 @@ checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -3108,12 +3038,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - [[package]] name = "futures" version = "0.3.31" @@ -3170,7 +3094,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -3326,9 +3250,6 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.8", -] [[package]] name = "hashbrown" @@ -3834,7 +3755,7 @@ checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -4402,7 +4323,7 @@ version = "57.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be3e4f6d320dd92bfa7d612e265d7d08bba0a240bab86af3425e1d255a511d89" dependencies = [ - "ahash 0.8.12", + "ahash", "arrow-array", "arrow-buffer", "arrow-cast", @@ -4456,7 +4377,7 @@ dependencies = [ "regex", "regex-syntax", "structmeta", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -4584,7 +4505,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -4657,7 +4578,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -4732,7 +4653,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -4779,7 +4700,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.113", + "syn 2.0.114", "tempfile", ] @@ -4793,7 +4714,7 @@ dependencies = [ "itertools 0.14.0", "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -4824,26 +4745,6 @@ dependencies = [ "cc", ] -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "quad-rand" version = "0.2.3" @@ -4930,12 +4831,6 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - [[package]] name = "radix_trie" version = "0.2.1" @@ -5052,7 +4947,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76009fbe0614077fc1a2ce255e3a1881a2e3a3527097d5dc6d8212c585e7e38b" dependencies = [ "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -5101,7 +4996,7 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -5155,15 +5050,6 @@ version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" -[[package]] -name = "rend" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" -dependencies = [ - "bytecheck", -] - [[package]] name = "repr_offset" version = "0.2.2" @@ -5229,35 +5115,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rkyv" -version = "0.7.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2297bf9c81a3f0dc96bc9521370b88f054168c29826a75e89c55ff196e7ed6a1" -dependencies = [ - "bitvec", - "bytecheck", - "bytes", - "hashbrown 0.12.3", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", - "tinyvec", - "uuid", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84d7b42d4b8d06048d3ac8db0eb31bcb942cbeb709f0b5f2b2ebde398d3038f5" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "rstest" version = "0.26.1" @@ -5283,7 +5140,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.113", + "syn 2.0.114", "unicode-ident", ] @@ -5295,24 +5152,7 @@ checksum = "b3a8fb4672e840a587a66fc577a5491375df51ddb88f2a2c2a792598c326fe14" dependencies = [ "quote", "rand 0.8.5", - "syn 2.0.113", -] - -[[package]] -name = "rust_decimal" -version = "1.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35affe401787a9bd846712274d97654355d21b2a2c092a3139aabe31e9022282" -dependencies = [ - "arrayvec", - "borsh", - "bytes", - "num-traits", - "postgres-types", - "rand 0.8.5", - "rkyv", - "serde", - "serde_json", + "syn 2.0.114", ] [[package]] @@ -5499,7 +5339,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -5508,12 +5348,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - [[package]] name = "security-framework" version = "3.5.1" @@ -5590,7 +5424,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -5601,14 +5435,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] name = "serde_json" -version = "1.0.148" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "itoa", "memchr", @@ -5625,7 +5459,7 @@ checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -5637,7 +5471,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -5680,7 +5514,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -5857,7 +5691,7 @@ checksum = "da5fc6819faabb412da764b99d3b713bb55083c11e7e0c00144d386cd6a1939c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -5905,7 +5739,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta-derive", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -5916,7 +5750,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -5934,7 +5768,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -5968,7 +5802,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "syn 2.0.113", + "syn 2.0.114", "typify", "walkdir", ] @@ -5992,9 +5826,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.113" +version = "2.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678faa00651c9eb72dd2020cbdf275d92eccb2400d568e419efdd64838145cb4" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" dependencies = [ "proc-macro2", "quote", @@ -6018,7 +5852,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -6035,12 +5869,6 @@ dependencies = [ "windows", ] -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - [[package]] name = "tempfile" version = "3.24.0" @@ -6121,7 +5949,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -6244,7 +6072,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -6445,7 +6273,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -6553,7 +6381,7 @@ dependencies = [ "semver", "serde", "serde_json", - "syn 2.0.113", + "syn 2.0.114", "thiserror", "unicode-ident", ] @@ -6571,7 +6399,7 @@ dependencies = [ "serde", "serde_json", "serde_tokenstream", - "syn 2.0.113", + "syn 2.0.114", "typify-impl", ] @@ -6818,7 +6646,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", "wasm-bindgen-shared", ] @@ -6860,7 +6688,7 @@ checksum = "7150335716dce6028bead2b848e72f47b45e7b9422f64cccdc23bedca89affc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -7014,7 +6842,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -7025,7 +6853,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -7281,15 +7109,6 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - [[package]] name = "xattr" version = "1.6.1" @@ -7331,28 +7150,28 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.31" +version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" +checksum = "1fabae64378cb18147bb18bca364e63bdbe72a0ffe4adf0addfec8aa166b2c56" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.31" +version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" +checksum = "c9c2d862265a8bb4471d87e033e730f536e2a285cc7cb05dbce09a2a97075f90" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] @@ -7372,7 +7191,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", "synstructure", ] @@ -7412,7 +7231,7 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.113", + "syn 2.0.114", ] [[package]] diff --git a/datafusion/sqllogictest/Cargo.toml b/datafusion/sqllogictest/Cargo.toml index b47d9f2c3dc78..dcec858a2475a 100644 --- a/datafusion/sqllogictest/Cargo.toml +++ b/datafusion/sqllogictest/Cargo.toml @@ -55,9 +55,7 @@ indicatif = "0.18" itertools = { workspace = true } log = { workspace = true } object_store = { workspace = true } -postgres-protocol = { version = "0.6.7", optional = true } postgres-types = { version = "0.2.11", features = ["derive", "with-chrono-0_4"], optional = true } -rust_decimal = { version = "1.39.0", features = ["tokio-pg"] } # When updating the following dependency verify that sqlite test file regeneration works correctly # by running the regenerate_sqlite_files.sh script. sqllogictest = "0.28.4" @@ -75,7 +73,6 @@ postgres = [ "bytes", "chrono", "postgres-types", - "postgres-protocol", "testcontainers-modules", "tokio-postgres", ] diff --git a/datafusion/sqllogictest/src/engines/conversion.rs b/datafusion/sqllogictest/src/engines/conversion.rs index 633029a2def29..3e519042f4ee0 100644 --- a/datafusion/sqllogictest/src/engines/conversion.rs +++ b/datafusion/sqllogictest/src/engines/conversion.rs @@ -18,7 +18,7 @@ use arrow::datatypes::{Decimal128Type, Decimal256Type, DecimalType, i256}; use bigdecimal::BigDecimal; use half::f16; -use rust_decimal::prelude::*; +use std::str::FromStr; /// Represents a constant for NULL string in your database. pub const NULL_STR: &str = "NULL"; @@ -115,8 +115,8 @@ pub(crate) fn decimal_256_to_str(value: i256, scale: i8) -> String { } #[cfg(feature = "postgres")] -pub(crate) fn decimal_to_str(value: Decimal) -> String { - big_decimal_to_str(BigDecimal::from_str(&value.to_string()).unwrap(), None) +pub(crate) fn decimal_to_str(value: BigDecimal) -> String { + big_decimal_to_str(value, None) } /// Converts a `BigDecimal` to its plain string representation, optionally rounding to a specified number of decimal places. diff --git a/datafusion/sqllogictest/src/engines/postgres_engine/mod.rs b/datafusion/sqllogictest/src/engines/postgres_engine/mod.rs index b14886fedd617..c3f266dcd1b62 100644 --- a/datafusion/sqllogictest/src/engines/postgres_engine/mod.rs +++ b/datafusion/sqllogictest/src/engines/postgres_engine/mod.rs @@ -16,6 +16,7 @@ // under the License. use async_trait::async_trait; +use bigdecimal::BigDecimal; use bytes::Bytes; use datafusion::common::runtime::SpawnedTask; use futures::{SinkExt, StreamExt}; @@ -32,12 +33,8 @@ use crate::engines::output::{DFColumnType, DFOutput}; use chrono::{NaiveDate, NaiveDateTime, NaiveTime}; use indicatif::ProgressBar; use postgres_types::Type; -use rust_decimal::Decimal; use tokio::time::Instant; -use tokio_postgres::{Column, Row}; -use types::PgRegtype; - -mod types; +use tokio_postgres::{SimpleQueryMessage, SimpleQueryRow}; // default connect string, can be overridden by the `PG_URL` environment variable const PG_URI: &str = "postgresql://postgres@127.0.0.1/test"; @@ -299,8 +296,20 @@ impl sqllogictest::AsyncDB for Postgres { self.pb.inc(1); return Ok(DBOutput::StatementComplete(0)); } + // Use a prepared statement to get the output column types + let statement = self.get_client().prepare(sql).await?; + let types: Vec = statement + .columns() + .iter() + .map(|c| c.type_().clone()) + .collect(); + + // Run the actual query using the "simple query" protocol that returns all + // rows as text. Doing this avoids having to convert values from the binary + // format to strings, which is somewhat tricky for numeric types. + // See https://github.com/apache/datafusion/pull/19666#discussion_r2668090587 let start = Instant::now(); - let rows = self.get_client().query(sql, &[]).await?; + let messages = self.get_client().simple_query(sql).await?; let duration = start.elapsed(); if duration.gt(&Duration::from_millis(500)) { @@ -309,30 +318,16 @@ impl sqllogictest::AsyncDB for Postgres { self.pb.inc(1); - let types: Vec = if rows.is_empty() { - self.get_client() - .prepare(sql) - .await? - .columns() - .iter() - .map(|c| c.type_().clone()) - .collect() - } else { - rows[0] - .columns() - .iter() - .map(|c| c.type_().clone()) - .collect() - }; - self.currently_executing_sql_tracker.remove_sql(tracked_sql); + let rows = convert_rows(&types, &messages); + if rows.is_empty() && types.is_empty() { Ok(DBOutput::StatementComplete(0)) } else { Ok(DBOutput::Rows { types: convert_types(types), - rows: convert_rows(&rows), + rows, }) } } @@ -351,58 +346,68 @@ impl sqllogictest::AsyncDB for Postgres { } } -fn convert_rows(rows: &[Row]) -> Vec> { - rows.iter() +fn convert_rows(types: &[Type], messages: &[SimpleQueryMessage]) -> Vec> { + messages + .iter() + .filter_map(|message| match message { + SimpleQueryMessage::Row(row) => Some(row), + _ => None, + }) .map(|row| { - row.columns() + types .iter() .enumerate() - .map(|(idx, column)| cell_to_string(row, column, idx)) + .map(|(idx, column_type)| cell_to_string(row, column_type, idx)) .collect::>() }) .collect::>() } -macro_rules! make_string { - ($row:ident, $idx:ident, $t:ty) => {{ - let value: Option<$t> = $row.get($idx); - match value { - Some(value) => value.to_string(), - None => NULL_STR.to_string(), +fn cell_to_string(row: &SimpleQueryRow, column_type: &Type, idx: usize) -> String { + // simple_query returns text values, so we parse by Postgres type to keep + // normalization aligned with the DataFusion engine output. + let value = row.get(idx); + match (column_type, value) { + (_, None) => NULL_STR.to_string(), + (&Type::CHAR, Some(value)) => value + .as_bytes() + .first() + .map(|byte| (*byte as i8).to_string()) + .unwrap_or_else(|| NULL_STR.to_string()), + (&Type::INT2, Some(value)) => value.parse::().unwrap().to_string(), + (&Type::INT4, Some(value)) => value.parse::().unwrap().to_string(), + (&Type::INT8, Some(value)) => value.parse::().unwrap().to_string(), + (&Type::NUMERIC, Some(value)) => { + decimal_to_str(BigDecimal::from_str(value).unwrap()) } - }}; - ($row:ident, $idx:ident, $t:ty, $convert:ident) => {{ - let value: Option<$t> = $row.get($idx); - match value { - Some(value) => $convert(value).to_string(), - None => NULL_STR.to_string(), + // Parse date/time strings explicitly to avoid locale-specific formatting. + (&Type::DATE, Some(value)) => NaiveDate::parse_from_str(value, "%Y-%m-%d") + .unwrap() + .to_string(), + (&Type::TIME, Some(value)) => NaiveTime::parse_from_str(value, "%H:%M:%S%.f") + .unwrap() + .to_string(), + (&Type::TIMESTAMP, Some(value)) => { + let parsed = NaiveDateTime::parse_from_str(value, "%Y-%m-%d %H:%M:%S%.f") + .or_else(|_| NaiveDateTime::parse_from_str(value, "%Y-%m-%dT%H:%M:%S%.f")) + .unwrap(); + format!("{parsed:?}") } - }}; -} - -fn cell_to_string(row: &Row, column: &Column, idx: usize) -> String { - match column.type_().clone() { - Type::CHAR => make_string!(row, idx, i8), - Type::INT2 => make_string!(row, idx, i16), - Type::INT4 => make_string!(row, idx, i32), - Type::INT8 => make_string!(row, idx, i64), - Type::NUMERIC => make_string!(row, idx, Decimal, decimal_to_str), - Type::DATE => make_string!(row, idx, NaiveDate), - Type::TIME => make_string!(row, idx, NaiveTime), - Type::TIMESTAMP => { - let value: Option = row.get(idx); - value - .map(|d| format!("{d:?}")) - .unwrap_or_else(|| "NULL".to_string()) + (&Type::BOOL, Some(value)) => { + let parsed = match value { + "t" | "true" | "TRUE" => true, + "f" | "false" | "FALSE" => false, + _ => panic!("Unsupported boolean value: {value}"), + }; + bool_to_str(parsed) } - Type::BOOL => make_string!(row, idx, bool, bool_to_str), - Type::BPCHAR | Type::VARCHAR | Type::TEXT => { - make_string!(row, idx, &str, varchar_to_str) + (&Type::BPCHAR | &Type::VARCHAR | &Type::TEXT, Some(value)) => { + varchar_to_str(value) } - Type::FLOAT4 => make_string!(row, idx, f32, f32_to_str), - Type::FLOAT8 => make_string!(row, idx, f64, f64_to_str), - Type::REGTYPE => make_string!(row, idx, PgRegtype), - _ => unimplemented!("Unsupported type: {}", column.type_().name()), + (&Type::FLOAT4, Some(value)) => f32_to_str(value.parse::().unwrap()), + (&Type::FLOAT8, Some(value)) => f64_to_str(value.parse::().unwrap()), + (&Type::REGTYPE, Some(value)) => value.to_string(), + _ => unimplemented!("Unsupported type: {}", column_type.name()), } } diff --git a/datafusion/sqllogictest/src/engines/postgres_engine/types.rs b/datafusion/sqllogictest/src/engines/postgres_engine/types.rs deleted file mode 100644 index 510462befb086..0000000000000 --- a/datafusion/sqllogictest/src/engines/postgres_engine/types.rs +++ /dev/null @@ -1,45 +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 postgres_types::Type; -use std::fmt::Display; -use tokio_postgres::types::FromSql; - -pub struct PgRegtype { - value: String, -} - -impl<'a> FromSql<'a> for PgRegtype { - fn from_sql( - _: &Type, - buf: &'a [u8], - ) -> Result> { - let oid = postgres_protocol::types::oid_from_sql(buf)?; - let value = Type::from_oid(oid).ok_or("bad type")?.to_string(); - Ok(PgRegtype { value }) - } - - fn accepts(ty: &Type) -> bool { - matches!(*ty, Type::REGTYPE) - } -} - -impl Display for PgRegtype { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.value) - } -}