From b090c194f363692b8d68bc749b03ea8050ce3b4d Mon Sep 17 00:00:00 2001 From: Yanxin Xiang Date: Sun, 18 Feb 2024 16:42:34 -0600 Subject: [PATCH] optimize code --- datafusion/core/src/datasource/listing/table.rs | 1 + datafusion/sql/src/planner.rs | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/datafusion/core/src/datasource/listing/table.rs b/datafusion/core/src/datasource/listing/table.rs index 3263489e530e4..094b26bfbd991 100644 --- a/datafusion/core/src/datasource/listing/table.rs +++ b/datafusion/core/src/datasource/listing/table.rs @@ -937,6 +937,7 @@ mod tests { Ok(()) } + #[cfg(feature = "parquet")] #[tokio::test] async fn load_table_stats_by_default() -> Result<()> { diff --git a/datafusion/sql/src/planner.rs b/datafusion/sql/src/planner.rs index 43bfc1467577b..bda4dd404ac95 100644 --- a/datafusion/sql/src/planner.rs +++ b/datafusion/sql/src/planner.rs @@ -502,16 +502,13 @@ pub fn object_name_to_table_reference( let ObjectName(idents) = object_name; idents_to_table_reference(idents, enable_normalization) } -pub fn substitute_tilde(cur: String) -> String { +fn substitute_tilde(cur: String) -> String { if let Ok(usr_dir) = env::var("HOME") { if cur.starts_with('~') { - cur.replacen('~', &usr_dir, 1) - } else { - cur + return cur.replacen('~', &usr_dir, 1); } - } else { - cur } + cur } /// Create a [`OwnedTableReference`] after normalizing the specified identifier pub(crate) fn idents_to_table_reference(