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

Đang mở
#5,754 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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?

Ngôn ngữ chính
Rust
Star
10.9k
Fork
261
Merge trung bình
3 ngày 21 giờ
Pull request đã merge (30 ngày)
84

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PRQL/prql

Tất cả issue của PRQL/prql

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.