This is an automated email from the ASF dual-hosted git repository.

agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 827cab921 Fix code generation for json feature (#3367)
827cab921 is described below

commit 827cab9219f90679c5616ebf73779cefe7186d4c
Author: Brent Gardner <[email protected]>
AuthorDate: Mon Sep 5 14:48:34 2022 -0700

    Fix code generation for json feature (#3367)
---
 datafusion/proto/build.rs             | 2 +-
 datafusion/proto/src/generated/mod.rs | 6 ++++++
 datafusion/proto/src/lib.rs           | 6 +++++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/datafusion/proto/build.rs b/datafusion/proto/build.rs
index 9b1b4e393..7e59107ea 100644
--- a/datafusion/proto/build.rs
+++ b/datafusion/proto/build.rs
@@ -55,7 +55,7 @@ fn build() -> Result<(), String> {
     let mut file = std::fs::OpenOptions::new()
         .write(true)
         .create(true)
-        .open("src/generated/datafusion.rs")
+        .open("src/generated/datafusion_json.rs")
         .unwrap();
     file.write(proto.as_str().as_ref()).unwrap();
     file.write(json.as_str().as_ref()).unwrap();
diff --git a/datafusion/proto/src/generated/mod.rs 
b/datafusion/proto/src/generated/mod.rs
index 750ab315f..f3154b265 100644
--- a/datafusion/proto/src/generated/mod.rs
+++ b/datafusion/proto/src/generated/mod.rs
@@ -18,4 +18,10 @@
 // include the generated protobuf source as a submodule
 #[allow(clippy::all)]
 #[rustfmt::skip]
+#[cfg(not(feature = "json"))]
 pub mod datafusion;
+
+#[allow(clippy::all)]
+#[rustfmt::skip]
+#[cfg(feature = "json")]
+pub mod datafusion_json;
diff --git a/datafusion/proto/src/lib.rs b/datafusion/proto/src/lib.rs
index 5f3bc47a9..7e009a846 100644
--- a/datafusion/proto/src/lib.rs
+++ b/datafusion/proto/src/lib.rs
@@ -24,7 +24,11 @@ pub mod from_proto;
 pub mod generated;
 pub mod logical_plan;
 pub mod to_proto;
-use generated::datafusion as protobuf;
+
+#[cfg(not(feature = "json"))]
+pub use generated::datafusion as protobuf;
+#[cfg(feature = "json")]
+pub use generated::datafusion_json as protobuf;
 
 #[cfg(doctest)]
 doc_comment::doctest!("../README.md", readme_example_test);

Reply via email to