-
Notifications
You must be signed in to change notification settings - Fork 605
Why custom Dialect doesn't work properly #1186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@alamb Hi, could you please take a look at this issue? I didn't find any more instructions about this custom Dialect |
I am not sure what is going on @groobyming -- your description certainly sounds like a bug. Maybe there is code in the parser that is special casing HiveDialect rather than using a trait method: https://github.com/search?q=repo%3Asqlparser-rs%2Fsqlparser-rs%20HiveDialect&type=code |
@alamb Thanks, when I added the following code in src/dialect/tokenizer.rs, it worked for me, but I still don't know why it works So if I want to extend my own dialect, do I need to modify the source code and then package it for release? |
that is one alternative Another is to change the code so that rather than testing |
Thanks @groobyming -- I will try and take a look at the outstanding sqlparser PRs next week sometime. I don't think I'll have a chance to do so this week |
@alamb OK,Thanks |
@groobyming I ran into a similar issue here #1227. If you want your dialect to "extend" an existing dialect, you can implement the impl Dialect for MyDialect {
fn dialect(&self) -> std::any::TypeId {
std::any::TypeId::of::<HiveDialect>()
} This'll allow the parser to treat it as that dialect whenever there is a check for IMO, more logic needs to move out of the |
I have extended a Dialect named MyDialect, and implemented the is_identifier_start method. is_identifier_start allows the identifier to start with a number, but why does my test code report an error? The prompt says that it cannot start with a number, and if I run it with the native HiveDialect, the code No problem again
My Code:
HIveDialect Code(from sqlparser-rs)
use crate::dialect::Dialect;
/// A [
Dialect
] for Hive.Error:

The text was updated successfully, but these errors were encountered: