Skip to content

Commit

Permalink
Fix code generation for json feature (#3367)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Gardner authored Sep 5, 2022
1 parent ede82fb commit 827cab9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion datafusion/proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions datafusion/proto/src/generated/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 5 additions & 1 deletion datafusion/proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 827cab9

Please sign in to comment.