Compiled Cypher on Postgres: apply =~'s two pattern rewrites in drivine4j's order
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia da drivine/cypher/sql/postgres_cypher_compiler.py:589, in matches, e confronta le due chiamate a regexp_replace con l’ordine mostrato nell’issue. Scambia il loro ordine in modo che l’ancoraggio avvenga per primo. Controlla l’SQL compilato per il pattern di esempio e conferma che le istruzioni della spec producano lo stesso testo delle altre librerie Drivine.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
A tidy-up. The results are the same; only the SQL text differs from drivine4j's.
I compiled the 998 statements of the Cypher spec at v0.6.18 with drivine4j (main, 3c5c4e5a), Drivine for TypeScript (master, e5b5d2b) and this library (main, a684245). On Postgres, =~ is the one place where this library alone writes different text from the other two.
What happens: matches (drivine/cypher/sql/postgres_cypher_compiler.py:589) first adds the w flag, when the flags hold both s and m, and then anchors the pattern:
regexp_replace(regexp_replace(<pattern>, '^\(\?([a-z]*(s[a-z]*m|m[a-z]*s)[a-z]*)\)', '(?\1w)'), '^(\(\?([a-z]+)\))?(.*)$', '(?p\2)\\A(\3)\\Z')
drivine4j (PostgresCypherCompiler.kt:416) and Drivine for TypeScript (PostgresCypherCompiler.ts:503) anchor first and then add the w:
regexp_replace(regexp_replace(<pattern>, '^(\(\?([a-z]+)\))?(.*)$', '(?p\2)\\A(\3)\\Z'), '^\(\?([a-z]*(s[a-z]*m|m[a-z]*s)[a-z]*)\)', '(?\1w)')
Both orders turn (?sm)a.b into (?psmw)\A(a.b)\Z. A pattern without both flags gets no w either way. So the results are the same, and the spec passes here. This shows up in 11 spec statements, for example RETURN 'a\nb' =~ '(?ims)A$.^B'.
Why bother: with the same text, a compile of the spec compares byte for byte across the libraries, so a real difference stands out. These 11 are about a quarter of the 41 Postgres statements where the two ports' SQL differs.
A fix: swap the two regexp_replace calls in matches, so the pattern is anchored first, as drivine4j does.
A tidy-up, so it goes in Next release + 2.
- Lingua principale
- Python
- Stelle
- 1
- Fork
- 0
- Merge medio
- 1h 19m
- PR unite (30g)
- 122
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di liberation-data/drivine-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
liberation-data/drivine-python#252 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
liberation-data/drivine-python#209 ·
I maintainer di solito rispondono entro 1 giorno
-
CI: three Oracle-only tests in test_cypher_compiled.py never run, as -k oracle doesn't select themAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
liberation-data/drivine-python#178 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
liberation-data/drivine-python#243 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
liberation-data/drivine-python#241 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di liberation-data/drivine-python
Issue simili
-
app: scripts status: backlog type: documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
netbox-community/netbox-scripts#68 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
marin-community/marin#10765 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
flathub/com.unity.UnityHub#230 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
namespace operations
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 63/100
EclipseFdn/open-vsx.org#14910 ·
I maintainer di solito rispondono entro 1 giorno