graphprotocol / graphprotocol/graph-node
[Feature] Better parsing of indexing SQL statements
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.2k
- Forks
- 1.1k
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 1
Description
Description
Currently we parse indexing SQL statements with our own homegrown parser. It needs to be updated in order to support the new kinds of indexes. Discussion here shows some of deficiencies. In particular the fn is_same_kind_columns in index.rs has to jump through some hoops in order to compare if the two expressions are "kind of same". For instance BlockRangeLower and Unknown("lower(block_range) int4_minmax_multi_ops)"). Also the test generate_ddl() has a commented out line in the mock_thing_index_list for the same reason.
Related to this is generator of SQL statements that is not perfectly sanitising it's output, somewhat addressed in this.
One approach would be to extend the current parser to handle those cases. Other would be to use sqlparser or similar.
Are you aware of any blockers that must be resolved before implementing this feature? If so, which? Link to any relevant GitHub issues.
No response
Some information to help us out
- Tick this box if you plan on implementing this feature yourself.
- I have searched the issue tracker to make sure this issue is not a duplicate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with fn is_same_kind_columns in index.rs and the generate_ddl() test, including the commented entry in mock_thing_index_list. Review the linked discussion and compare extending the current parser with using sqlparser or a similar parser. Done means new index kinds and expressions such as BlockRangeLower are parsed and compared without the current workarounds, with SQL output sanitization addressed as appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100