mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 18:57:21 +00:00
update README
This commit is contained in:
parent
b961069595
commit
4daa1a2827
1 changed files with 13 additions and 0 deletions
13
README.md
13
README.md
|
@ -21,4 +21,17 @@ This outputs
|
||||||
AST: SQLSelect { projection: [SQLIdentifier("a"), SQLIdentifier("b"), SQLLiteralLong(123), SQLFunction { id: "myfunc", args: [SQLIdentifier("b")] }], relation: Some(SQLIdentifier("table_1")), selection: Some(SQLBinaryExpr { left: SQLBinaryExpr { left: SQLIdentifier("a"), op: Gt, right: SQLIdentifier("b") }, op: And, right: SQLBinaryExpr { left: SQLIdentifier("b"), op: Lt, right: SQLLiteralLong(100) } }), order_by: Some([SQLOrderBy { expr: SQLIdentifier("a"), asc: false }, SQLOrderBy { expr: SQLIdentifier("b"), asc: true }]), group_by: None, having: None, limit: None }
|
AST: SQLSelect { projection: [SQLIdentifier("a"), SQLIdentifier("b"), SQLLiteralLong(123), SQLFunction { id: "myfunc", args: [SQLIdentifier("b")] }], relation: Some(SQLIdentifier("table_1")), selection: Some(SQLBinaryExpr { left: SQLBinaryExpr { left: SQLIdentifier("a"), op: Gt, right: SQLIdentifier("b") }, op: And, right: SQLBinaryExpr { left: SQLIdentifier("b"), op: Lt, right: SQLLiteralLong(100) } }), order_by: Some([SQLOrderBy { expr: SQLIdentifier("a"), asc: false }, SQLOrderBy { expr: SQLIdentifier("b"), asc: true }]), group_by: None, having: None, limit: None }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Design
|
||||||
|
|
||||||
|
This parser is implemented using the [Pratt Parser](https://tdop.github.io/) design, which is a top-down operator-precedence parser.
|
||||||
|
|
||||||
|
I am a fan of this design pattern over parser generators for the following reasons:
|
||||||
|
|
||||||
|
- Parsing code is simple to write and can be concise and elegant (this is far from true for this current implementation unfortunately, but I hope to fix that using some macros)
|
||||||
|
- Performance is generally better than code generated by parser generators
|
||||||
|
- Debugging is much easier with hand-written code
|
||||||
|
- It is far easier to extend and make dialect-specific extensions compared to using a parser generator
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
Please get involved in helping build first class SQL support in Rust by filing issues for missing features (there are plenty!) and create pull requests.
|
Please get involved in helping build first class SQL support in Rust by filing issues for missing features (there are plenty!) and create pull requests.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue