Skip to content

Apache DataFusion SQL Query Engine

fix: Fix local `datafusion-cli` test failure (#21761)

Yongting You9a851d6c74a6
diff --git a/Cargo.lock b/Cargo.lock
index 02da8661ee..e1ba084184 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1925,6 +1925,7 @@ dependencies = [
"regex",
"rstest",
"rustyline",
+ "serde_json",
"testcontainers-modules",
"tokio",
"url",
diff --git a/datafusion-cli/Cargo.toml b/datafusion-cli/Cargo.toml
index 40e0e50dac..19dc83d518 100644
--- a/datafusion-cli/Cargo.toml
+++ b/datafusion-cli/Cargo.toml
@@ -78,3 +78,11 @@ insta = { workspace = true }
insta-cmd = "0.6.0"
rstest = { workspace = true }
testcontainers-modules = { workspace = true, features = ["minio"] }
+# Makes sure `test_display_pg_json` behaves in a consistent way regardless of
+# feature unification with dependencies
+serde_json = { workspace = true, features = ["preserve_order"] }
+
+# Required because we pull serde_json with a feature to get consistent pg display,
+# but its not directly used.
+[package.metadata.cargo-machete]
+ignored = "serde_json"
diff --git a/datafusion-cli/tests/snapshots/cli_explain_environment_overrides@explain_plan_environment_overrides.snap b/datafusion-cli/tests/snapshots/cli_explain_environment_overrides@explain_plan_environment_overrides.snap
index 1359cefbe7..5f43ca88dc 100644
--- a/datafusion-cli/tests/snapshots/cli_explain_environment_overrides@explain_plan_environment_overrides.snap
+++ b/datafusion-cli/tests/snapshots/cli_explain_environment_overrides@explain_plan_environment_overrides.snap
@@ -18,19 +18,19 @@ exit_code: 0
| logical_plan | [ |
| | { |
| | "Plan": { |
-| | "Expressions": [ |
-| | "Int64(123)" |
-| | ], |
| | "Node Type": "Projection", |
-| | "Output": [ |
+| | "Expressions": [ |
| | "Int64(123)" |
| | ], |
| | "Plans": [ |
| | { |
| | "Node Type": "EmptyRelation", |
-| | "Output": [], |
-| | "Plans": [] |
+| | "Plans": [], |
+| | "Output": [] |
| | } |
+| | ], |
+| | "Output": [ |
+| | "Int64(123)" |
| | ] |
| | } |
| | } |