You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "alexander-beedie (via GitHub)" <gi...@apache.org> on 2026/02/15 07:30:43 UTC
[PR] Fix `derive_dialect!` proc macro for use from external crates [datafusion-sqlparser-rs]
alexander-beedie opened a new pull request, #2219:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2219
Unfortunately I made a classic proc-macro blunder in #2174, forgetting that `$CARGO_MANIFEST_DIR` points to the crate _being compiled_, which is not the `sqlparser` crate. So all the tests worked (as the crate being compiled and the `sqlparser` crate are the same), but actual use from an external crate fails without exotic workarounds 😅
This PR fixes and industrialises that lookup; now it does the following (documented/explained in the code too):
1. `$CARGO_MANIFEST_DIR/src/dialect/mod.rs`: works when macro invoked from within the `sqlparser` crate (e.g. tests).
2. `<sqlparser_derive dir>/../src/dialect/mod.rs`: works when `sqlparser_derive` lives in a workspace alongside the main crate (standard `derive/` layout).
3. Sibling directories of compiled `sqlparser_derive` crate in the Cargo registry: works when an external crate uses `derive_dialect!` via registry dependency.
Confirmed this addresses the issue, and dialects can now be properly derived in/from external crates 👍
**Also:** minor tweak to use slightly more idiomatic `map_err!` inside `derive_dialect`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Fix `derive_dialect!` proc macro for use from external crates [datafusion-sqlparser-rs]
Posted by "iffyio (via GitHub)" <gi...@apache.org>.
iffyio merged PR #2219:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2219
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org