Comments (8)
@groobyming I ran into a similar issue here #1227.
If you want your dialect to "extend" an existing dialect, you can implement the dialect
function
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 dialect_of!
.
IMO, more logic needs to move out of the dialect_of!
macro, and into the Dialect
trait, but considering there are 100+ uses of dialect_of
in the parser, it may not be practical to add every one of those checks to Dialect
.
from sqlparser-rs.
@alamb Hi, could you please take a look at this issue? I didn't find any more instructions about this custom Dialect
from sqlparser-rs.
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
from sqlparser-rs.
@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?
from sqlparser-rs.
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 dilaect_of!(...)
it would do something like self.supports_numeric_prefix()
and adding fn supports_numeric_prefix
to the the Dialect
trait
from sqlparser-rs.
@alamb Thanks for the feedback! I'll create a PR to address this issue.
PR addressing: #1188
from sqlparser-rs.
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
from sqlparser-rs.
@alamb OK,Thanks
from sqlparser-rs.
Related Issues (20)
- MS SQL create table parse error HOT 1
- The DoubleColon cast always skips the AT TIME ZONE part, leading to strange behavior.
- feat: use EnumsAsInner to extract enum variants HOT 1
- group_concat not fully supported yet in 0.46 HOT 1
- Support column references and other expressions in RHS of AT TIME ZONE operator
- Support Snowflake lambda functions
- Support postgresql on commit for ctas
- Support mssql exec
- Support schema qualified stored procedures for mssql
- Support ClickHouse `CREATE VIEW`
- Support mssql within group
- Partition by not supported - postgre
- Add support for DROP PROCEDURE
- Regression parsing array slice expressions (`foo[1:2]`) in `0.46`
- VisitorMut example not working HOT 1
- Please support "alter table owner to" in Postgres HOT 1
- [DISCUSSION]: move sqlparser to Apache (DataFusion) governance HOT 10
- Release version `0.48.0`
- postgres operators starting with `&` are not parsed correctly HOT 1
- Support non-UTF-8 character in binary_data
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlparser-rs.