Proposal: Add `list` module to std for Array/List operations

Aperta
#5,754 3 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
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
backend

Direzione di ricerca

This proposal does not name implementation files, tests, or compiler entry points. Start by reading the standard library and dialect-mapping conventions, then check with the community whether the proposed API is accepted; done would mean an agreed scope for the module and its dialect support.

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

Descrizione

As modern OLAP engines (such as DuckDB, ClickHouse, BigQuery, and PostgreSQL) increasingly support complex data types like Arrays and Lists, there is a growing need for a standardized way to handle these types in PRQL.

Currently, PRQL has a dedicated text module for string manipulations. I propose introducing a list (or array) module to provide a consistent and intuitive API for common list operations, such as checking for the existence of elements.

I suggest adding a list module to the standard library with the following functions. These functions will allow users to perform membership tests on arrays easily.

function parameters description
has value arr Returns true if arr contains value
has_any values arr Returns true if arr contains any value from values
has_all values arr Returns true if arr contains all values from values
from employees
derive {
  has_title = ([title, "CEO"] | list.has title),
  has_any_role = ([title, country] | list.has_any [country, "CEO"]),
}

I am happy to work on the implementation and the necessary compiler mappings for various dialects if the community agrees with this direction. What do you think?

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.