From c1acce99436b898a78607b4b1b312c545c113e80 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Fri, 26 Sep 2025 11:07:00 +0800 Subject: [PATCH] refactor: cleanup datafusion-pg-catalog dependencies (#7025) * refactor: cleanup datafusion-pg-catalog dependencies Signed-off-by: Ning Sun * chore: toml format * feat: update upstream --------- 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 a6327742d1..8d6e3488f3 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=3d1b7c7d5b82dd49bafc2803259365e633f654fa#3d1b7c7d5b82dd49bafc2803259365e633f654fa" +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 72f5c8c0ba..6309233e71 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 = "3d1b7c7d5b82dd49bafc2803259365e633f654fa" } datafusion-physical-expr = "49" datafusion-physical-plan = "49" -datafusion-postgres = { git = "https://github.com/datafusion-contrib/datafusion-postgres", rev = "412dad6b88ca83d11498338896044319ddac676c" } datafusion-sql = "49" datafusion-substrait = "49" deadpool = "0.12" diff --git a/src/catalog/Cargo.toml b/src/catalog/Cargo.toml index 515fafad86..62674e2572 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 991f3f138d..f6729ded28 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 3ac122dcee..d5b928e2a1 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-pg-catalog.workspace = true datafusion-physical-expr.workspace = true -datafusion-postgres.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 006f31b137..c4b6d8bd4a 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 3294684345..89d05490ed 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 ba499af840..e41d7a4cd6 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};