Random function

Aperta
#4,661 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start by reading the PRQL compiler’s function handling and SQL dialect translation; the issue does not name specific files or tests. Define the desired random function behavior and how its range maps across supported SQL dialects before implementation. Done means PRQL accepts the proposed expression and generates correct SQL for the supported cases.

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

Descrizione

enhancement
What's up?

PRQL does not yet have any random function(s). SQL have the RAND function which can be used awkwardly used using s-strings.

It would be nice if PRQL has a random function, it could work like randint in Python, i.e. take in a low and high parameter in order to specify a range. The SQL RAND function does not have this feature it can takes a seed as parameter.

derive { random_value = (random low:100 high:1000) }
SELECT FLOOR(100 + RAND() * (1000 - 100 + 1)) AS random_value;

It could even generate a random letter:

derive { random_letter = (random low:A high:Z) }
SELECT CHAR(FLOOR(RAND() * (ASCII('A') - ASCII('Z')))) AS random_letter;
Lingua principale
Rust
Stelle
10.9k
Fork
261
Merge medio
3g 21h
PR unite (30g)
84

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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.

Altre issue di PRQL/prql

Tutte le issue di PRQL/prql

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.