Repository navigation
datafusion-substrait API docs on docs.rs are broken #13853
Description
Activity
Looks like it is trying to compile substrait 0.45 but itself seems to build just fine:
A recent change was made to Substrait that used a feature that was only stabilized in protoc versions greater than 3.12 (I'm not actually sure the exact version it was stailized). In version 3.12 it was available in an unstable format but requires a special flag to be passed to
protoc. Theprostcrate has no way of passing that special flag. As a result, the minimum version ofprotocis greater than 3.12 and this is the error you see if you are using 3.12.3.12 is a significant version because it is the version of
protobuf-compilerthat ships with Ubuntu 22.04 so that may explain why the docs build fails (no idea what it is building on so this is speculation but Ubuntu 22.04 is usually the culprit when I see this error).Note that DF explicitly states 3.15 protobuf compiler is required as of #11006
Ah, yes, according to https://github.com/rust-lang/crates-build-env it does appear that
docs.rsuses Ubuntu 22.04 to build crate docs.Thanks @westonpace
One thing I couldn't understand is how substrait the substrait docs themselves are built, seemingly just fine on docs.rs (the same runners): https://docs.rs/substrait/latest/substrait/
It doesn't seem to use any docs.rs speciic stuff:
https://github.com/substrait-io/substrait-rs/blob/bbcc9f6d0b084a13706f39a43bbba9d37bf2a959/Cargo.toml#L62Maybe we need to use a special flag for build or something:
https://github.com/substrait-io/substrait-rs/blob/bbcc9f6d0b084a13706f39a43bbba9d37bf2a959/Cargo.toml#L53🤔
Also, randomly, I learned today that @andygrove also is an owner of the substrait crate. Fascinating!

One thing I couldn't understand is how substrait the substrait docs themselves are built, seemingly just fine on docs.rs (the same runners)
@alamb oh, interesting. I hadn't thought about that question. Looking futher it seems it uses https://docs.rs/protobuf-src/latest/protobuf_src/ to build a vendored copy of protoc.
I'm not sure of the implications but it would be an interesting way to solve the problem.
- Reacted by Andrew Lamb
Ah! We just ran into this in substrait-io/substrait-validator#355, and like
substrait-rs, added aprotocfeature for usingprotobuf-srcto get aprotoccompiler, and then enabled that feature for docs.rs. See the issue for the breakdown of steps.substrait-validatorhasn't yet been released with that change, so docs.rs still shows an error, but I think we're on the way there.Would that change make sense here?
After looking more closely, it looks like
datafusion-substraithas aprotocfeature:
protoc = ["substrait/protoc"] Building locally, it looks like this feature covers everything we need it to for docs. Using
protoc@3.12.4downloaded from here and adding it to my path:datafusion ❯ PATH="$HOME/protobuf/bin:$PATH" cargo doc … Error: Custom { kind: Other, error: "protoc failed: substrait/algebra.proto: This file contains proto3 optional fields, but --experimental_allow_proto3_optional was not set.\n" } datafusion ❯ PATH="$HOME/protobuf/bin:$PATH" cargo doc --features protoc Finished `dev` profile [unoptimized + debuginfo] target(s) in 7m 10s Generated /Users/wendell.smith/go/src/github.com/DataDog/datafusion/target/doc/datafusion/index.html and 42 other files
So I think probably all that needs doing is adding the directive for
docs.rsto use the feature:
https://github.com/substrait-io/substrait-rs/blob/bbcc9f6d0b084a13706f39a43bbba9d37bf2a959/Cargo.tomlThat said - I think that should be done in
datafusion/substrait/Cargo.toml, and not the workspaceCargo.toml, and I'm not entirely certain, and I'm not sure how to find out. I've tried to rundocs.rslocally following the instructions here and here, but I haven't been able to reproduce theexperimental_allow_proto3_optional was not seterror.We could just add that directive to
datafusion/substrait/Cargo.tomland see if it fixes it in the next version? Any other ideas?We could just add that directive to datafusion/substrait/Cargo.toml and see if it fixes it in the next version? Any other ideas?
This sounds like a great idea to me -- thank you @wackywendell
FYI - the similar changes for
substrait-validatorattached to substrait-io/substrait-validator#355 does seem to have fixed the docs there! Hopefully we'll see the changes here present in thedatafusion-substraitdocs in the next release.FYI - the similar changes for
substrait-validatorattached to substrait-io/substrait-validator#355 does seem to have fixed the docs there! Hopefully we'll see the changes here present in thedatafusion-substraitdocs in the next release.🤞 -- Thanks @wackywendell
After releasing version 45 the docs are back ❤ 👓 . Thanks again @wackywendell
https://docs.rs/datafusion-substrait/latest/datafusion_substrait/

Describe the bug
While reviewing #13803 from @vbarua I noticed that the substrait API docs on docs.rs are broken
To Reproduce
Go to: https://docs.rs/crate/datafusion-substrait/latest
According to the build log
https://docs.rs/crate/datafusion-substrait/43.0.0/builds/1509810
It appears that the issue is that issue is with the protobuf compiler for some reason 🤔
Expected behavior
I expect them to look like the last successful build: https://docs.rs/crate/datafusion-substrait/41.0.0
Additional context
No response