graphprotocol / graphprotocol/graph-node

[Feature] Better parsing of indexing SQL statements

Aperta
#5,512 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement Stale
Lingua principale
Rust
Stelle
3.2k
Fork
1.1k
Merge medio
4g 1h
PR unite (30g)
1

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con fn is_same_kind_columns in index.rs e il test generate_ddl(), inclusa la voce commentata in mock_thing_index_list. Esamina la discussione collegata e confronta l’estensione del parser attuale con l’uso di sqlparser o di un parser simile. Il lavoro è completato quando i nuovi tipi di indice e le espressioni come BlockRangeLower vengono analizzati e confrontati senza gli attuali workaround e la sanitizzazione dell’output SQL viene gestita adeguatamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust, sql
Ambito
databases
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.