From 29fbaaaeca8b0886801740276ebc477218f48f18 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Fri, 26 Sep 2025 01:08:39 +0800 Subject: [PATCH 1/3] refactor: cleanup datafusion-pg-catalog dependencies Signed-off-by: Ning Sun --- Cargo.lock | 91 ++++---------------- Cargo.toml | 2 +- src/catalog/Cargo.toml | 2 +- src/catalog/src/system_schema/pg_catalog.rs | 10 +-- src/common/function/Cargo.toml | 2 +- src/common/function/src/system/pg_catalog.rs | 2 +- src/servers/Cargo.toml | 2 +- src/servers/src/postgres/handler.rs | 2 +- 8 files changed, 28 insertions(+), 85 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a6327742d174..6cd9c08aa6cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -479,20 +479,6 @@ dependencies = [ "arrow-select", ] -[[package]] -name = "arrow-pg" -version = "0.5.0" -source = "git+https://github.com/datafusion-contrib/datafusion-postgres?rev=412dad6b88ca83d11498338896044319ddac676c#412dad6b88ca83d11498338896044319ddac676c" -dependencies = [ - "bytes", - "chrono", - "datafusion", - "futures", - "pgwire", - "postgres-types", - "rust_decimal", -] - [[package]] name = "arrow-row" version = "56.1.0" @@ -1465,7 +1451,7 @@ dependencies = [ "common-workload", "dashmap", "datafusion", - "datafusion-postgres", + "datafusion-pg-catalog", "datatypes", "futures", "futures-util", @@ -2197,8 +2183,8 @@ dependencies = [ "datafusion-common", "datafusion-expr", "datafusion-functions-aggregate-common", + "datafusion-pg-catalog", "datafusion-physical-expr", - "datafusion-postgres", "datatypes", "derive_more", "futures", @@ -3727,6 +3713,19 @@ dependencies = [ "tokio", ] +[[package]] +name = "datafusion-pg-catalog" +version = "0.9.0" +source = "git+https://github.com/datafusion-contrib/datafusion-postgres?rev=da0f822e99d5b5aa80677f99cfd80ef31bfee9fd#da0f822e99d5b5aa80677f99cfd80ef31bfee9fd" +dependencies = [ + "async-trait", + "datafusion", + "futures", + "log", + "postgres-types", + "tokio", +] + [[package]] name = "datafusion-physical-expr" version = "49.0.0" @@ -3810,28 +3809,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "datafusion-postgres" -version = "0.9.0" -source = "git+https://github.com/datafusion-contrib/datafusion-postgres?rev=412dad6b88ca83d11498338896044319ddac676c#412dad6b88ca83d11498338896044319ddac676c" -dependencies = [ - "arrow-pg", - "async-trait", - "bytes", - "chrono", - "datafusion", - "futures", - "getset", - "log", - "pgwire", - "postgres-types", - "rust_decimal", - "rustls-pemfile", - "rustls-pki-types", - "tokio", - "tokio-rustls", -] - [[package]] name = "datafusion-pruning" version = "49.0.0" @@ -5314,18 +5291,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "getset" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf0fc11e47561d47397154977bc219f4cf809b2974facc3ccb3b89e2436f912" -dependencies = [ - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.104", -] - [[package]] name = "gimli" version = "0.31.1" @@ -9216,7 +9181,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddf403a6ee31cf7f2217b2bd8447cb13dbb6c268d7e81501bc78a4d3daafd294" dependencies = [ "async-trait", - "base64 0.22.1", "bytes", "chrono", "derive-new", @@ -9229,12 +9193,10 @@ dependencies = [ "ring", "rust_decimal", "rustls-pki-types", - "stringprep", "thiserror 2.0.12", "tokio", "tokio-rustls", "tokio-util", - "x509-certificate 0.24.0", ] [[package]] @@ -11601,7 +11563,7 @@ dependencies = [ "datafusion", "datafusion-common", "datafusion-expr", - "datafusion-postgres", + "datafusion-pg-catalog", "datatypes", "derive_builder 0.20.2", "futures", @@ -13421,7 +13383,7 @@ dependencies = [ "tokio", "tokio-postgres", "tokio-rustls", - "x509-certificate 0.23.1", + "x509-certificate", ] [[package]] @@ -15062,25 +15024,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "x509-certificate" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57b9f8bcae7c1f36479821ae826d75050c60ce55146fd86d3553ed2573e2762" -dependencies = [ - "bcder", - "bytes", - "chrono", - "der", - "hex", - "pem", - "ring", - "signature", - "spki", - "thiserror 1.0.69", - "zeroize", -] - [[package]] name = "xattr" version = "1.5.1" diff --git a/Cargo.toml b/Cargo.toml index 72f5c8c0ba99..ec4ed0230728 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -132,7 +132,7 @@ datafusion-optimizer = "49" datafusion-orc = { git = "https://github.com/GreptimeTeam/datafusion-orc", rev = "a0a5f902158f153119316eaeec868cff3fc8a99d" } datafusion-physical-expr = "49" datafusion-physical-plan = "49" -datafusion-postgres = { git = "https://github.com/datafusion-contrib/datafusion-postgres", rev = "412dad6b88ca83d11498338896044319ddac676c" } +datafusion-pg-catalog = { git = "https://github.com/datafusion-contrib/datafusion-postgres", rev = "da0f822e99d5b5aa80677f99cfd80ef31bfee9fd" } datafusion-sql = "49" datafusion-substrait = "49" deadpool = "0.12" diff --git a/src/catalog/Cargo.toml b/src/catalog/Cargo.toml index 515fafad8682..62674e25725b 100644 --- a/src/catalog/Cargo.toml +++ b/src/catalog/Cargo.toml @@ -35,7 +35,7 @@ common-version.workspace = true common-workload.workspace = true dashmap.workspace = true datafusion.workspace = true -datafusion-postgres.workspace = true +datafusion-pg-catalog.workspace = true datatypes.workspace = true futures.workspace = true futures-util.workspace = true diff --git a/src/catalog/src/system_schema/pg_catalog.rs b/src/catalog/src/system_schema/pg_catalog.rs index 991f3f138d60..f6729ded284e 100644 --- a/src/catalog/src/system_schema/pg_catalog.rs +++ b/src/catalog/src/system_schema/pg_catalog.rs @@ -26,9 +26,9 @@ use datafusion::datasource::TableType; use datafusion::error::DataFusionError; use datafusion::execution::TaskContext; use datafusion::physical_plan::stream::RecordBatchStreamAdapter as DfRecordBatchStreamAdapter; -use datafusion_postgres::pg_catalog::catalog_info::CatalogInfo; -use datafusion_postgres::pg_catalog::{ - PgCatalogSchemaProvider, PgCatalogStaticTables, PgCatalogTable, +use datafusion_pg_catalog::pg_catalog::catalog_info::CatalogInfo; +use datafusion_pg_catalog::pg_catalog::{ + PG_CATALOG_TABLES, PgCatalogSchemaProvider, PgCatalogStaticTables, PgCatalogTable, }; use snafu::ResultExt; use store_api::storage::ScanRequest; @@ -74,7 +74,7 @@ impl PGCatalogProvider { let mut table_ids = HashMap::new(); let mut table_id = PG_CATALOG_TABLE_ID_START; - for name in datafusion_postgres::pg_catalog::PG_CATALOG_TABLES { + for name in PG_CATALOG_TABLES { table_ids.insert(*name, table_id); table_id += 1; } @@ -94,7 +94,7 @@ impl PGCatalogProvider { // Must follow the same security rules as [`InformationSchemaProvider::build_tables`]. let mut tables = HashMap::new(); // It's safe to unwrap here because we are sure that the constants have been handle correctly inside system_table. - for name in datafusion_postgres::pg_catalog::PG_CATALOG_TABLES { + for name in PG_CATALOG_TABLES { if let Some(table) = self.build_table(name) { tables.insert(name.to_string(), table); } diff --git a/src/common/function/Cargo.toml b/src/common/function/Cargo.toml index 3ac122dcee8f..e2917f8254d6 100644 --- a/src/common/function/Cargo.toml +++ b/src/common/function/Cargo.toml @@ -37,7 +37,7 @@ datafusion-common.workspace = true datafusion-expr.workspace = true datafusion-functions-aggregate-common.workspace = true datafusion-physical-expr.workspace = true -datafusion-postgres.workspace = true +datafusion-pg-catalog.workspace = true datatypes.workspace = true derive_more = { version = "1", default-features = false, features = ["display"] } geo = { version = "0.29", optional = true } diff --git a/src/common/function/src/system/pg_catalog.rs b/src/common/function/src/system/pg_catalog.rs index 006f31b13718..c4b6d8bd4a79 100644 --- a/src/common/function/src/system/pg_catalog.rs +++ b/src/common/function/src/system/pg_catalog.rs @@ -22,7 +22,7 @@ use datafusion::catalog::TableFunction; use datafusion::common::ScalarValue; use datafusion::common::utils::SingleRowListArrayBuilder; use datafusion_expr::{ColumnarValue, ScalarFunctionArgs, Signature, Volatility}; -use datafusion_postgres::pg_catalog::{self, PgCatalogStaticTables}; +use datafusion_pg_catalog::pg_catalog::{self, PgCatalogStaticTables}; use datatypes::arrow::datatypes::{DataType, Field}; use derive_more::Display; use version::PGVersionFunction; diff --git a/src/servers/Cargo.toml b/src/servers/Cargo.toml index 329468434505..89d05490edf3 100644 --- a/src/servers/Cargo.toml +++ b/src/servers/Cargo.toml @@ -56,7 +56,7 @@ dashmap.workspace = true datafusion.workspace = true datafusion-common.workspace = true datafusion-expr.workspace = true -datafusion-postgres.workspace = true +datafusion-pg-catalog.workspace = true datatypes.workspace = true derive_builder.workspace = true futures.workspace = true diff --git a/src/servers/src/postgres/handler.rs b/src/servers/src/postgres/handler.rs index ba499af8404f..e41d7a4cd6c4 100644 --- a/src/servers/src/postgres/handler.rs +++ b/src/servers/src/postgres/handler.rs @@ -21,7 +21,7 @@ use common_recordbatch::RecordBatch; use common_recordbatch::error::Result as RecordBatchResult; use common_telemetry::{debug, tracing}; use datafusion_common::ParamValues; -use datafusion_postgres::sql::PostgresCompatibilityParser; +use datafusion_pg_catalog::sql::PostgresCompatibilityParser; use datatypes::prelude::ConcreteDataType; use datatypes::schema::SchemaRef; use futures::{Sink, SinkExt, Stream, StreamExt, future, stream}; From 4fe3bba6f48e03282088a50e148a75d7ce9047ee Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Fri, 26 Sep 2025 01:33:34 +0800 Subject: [PATCH 2/3] chore: toml format --- Cargo.toml | 2 +- src/common/function/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ec4ed0230728..3c2cb1af2d49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -130,9 +130,9 @@ datafusion-functions = "49" datafusion-functions-aggregate-common = "49" datafusion-optimizer = "49" datafusion-orc = { git = "https://github.com/GreptimeTeam/datafusion-orc", rev = "a0a5f902158f153119316eaeec868cff3fc8a99d" } +datafusion-pg-catalog = { git = "https://github.com/datafusion-contrib/datafusion-postgres", rev = "da0f822e99d5b5aa80677f99cfd80ef31bfee9fd" } datafusion-physical-expr = "49" datafusion-physical-plan = "49" -datafusion-pg-catalog = { git = "https://github.com/datafusion-contrib/datafusion-postgres", rev = "da0f822e99d5b5aa80677f99cfd80ef31bfee9fd" } datafusion-sql = "49" datafusion-substrait = "49" deadpool = "0.12" diff --git a/src/common/function/Cargo.toml b/src/common/function/Cargo.toml index e2917f8254d6..d5b928e2a16f 100644 --- a/src/common/function/Cargo.toml +++ b/src/common/function/Cargo.toml @@ -36,8 +36,8 @@ datafusion.workspace = true datafusion-common.workspace = true datafusion-expr.workspace = true datafusion-functions-aggregate-common.workspace = true -datafusion-physical-expr.workspace = true datafusion-pg-catalog.workspace = true +datafusion-physical-expr.workspace = true datatypes.workspace = true derive_more = { version = "1", default-features = false, features = ["display"] } geo = { version = "0.29", optional = true } From 394a683f179a25bf4bb2836533731eb11221b43d Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Fri, 26 Sep 2025 02:30:14 +0800 Subject: [PATCH 3/3] feat: update upstream --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6cd9c08aa6cc..8d6e3488f393 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3716,7 +3716,7 @@ dependencies = [ [[package]] name = "datafusion-pg-catalog" version = "0.9.0" -source = "git+https://github.com/datafusion-contrib/datafusion-postgres?rev=da0f822e99d5b5aa80677f99cfd80ef31bfee9fd#da0f822e99d5b5aa80677f99cfd80ef31bfee9fd" +source = "git+https://github.com/datafusion-contrib/datafusion-postgres?rev=3d1b7c7d5b82dd49bafc2803259365e633f654fa#3d1b7c7d5b82dd49bafc2803259365e633f654fa" dependencies = [ "async-trait", "datafusion", diff --git a/Cargo.toml b/Cargo.toml index 3c2cb1af2d49..6309233e71ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -130,7 +130,7 @@ datafusion-functions = "49" datafusion-functions-aggregate-common = "49" datafusion-optimizer = "49" datafusion-orc = { git = "https://github.com/GreptimeTeam/datafusion-orc", rev = "a0a5f902158f153119316eaeec868cff3fc8a99d" } -datafusion-pg-catalog = { git = "https://github.com/datafusion-contrib/datafusion-postgres", rev = "da0f822e99d5b5aa80677f99cfd80ef31bfee9fd" } +datafusion-pg-catalog = { git = "https://github.com/datafusion-contrib/datafusion-postgres", rev = "3d1b7c7d5b82dd49bafc2803259365e633f654fa" } datafusion-physical-expr = "49" datafusion-physical-plan = "49" datafusion-sql = "49"