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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to