Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

BIT_OR(), BIT_AND() and BIT_XOR() aggregates are not supported

Đang mở
#526 0 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 1 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
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php, sqlite
Lĩnh vực
database

Hướng nghiên cứu

Start by reading the SQLite function translation and registration code, especially the existing UDFs and any aggregate translations; the issue does not name specific files or tests. Then check how the project tests SQL compatibility and the pdo_sqlite integer limits described here. Done means BIT_OR(), BIT_AND(), and BIT_XOR() produce MySQL-compatible results, including NULLs, empty sets, and unsigned 64-bit values.

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

Mô tả

Reproduction

CREATE TABLE b (x INT);
INSERT INTO b (x) VALUES (1), (4), (NULL);
SELECT BIT_OR(x), BIT_AND(x), BIT_XOR(x) FROM b;
-- SQLSTATE[HY000]: General error: 1 no such function: BIT_OR

Expected (MySQL 8): 5, 0, 5. Over an empty set, MySQL returns 0 for BIT_OR and BIT_XOR, and 18446744073709551615 for BIT_AND. NULLs are ignored, and the result type is BIGINT UNSIGNED.

Reproduced on trunk (3.1.0) with PHP 8.3 and SQLite 3.45.1.

Implementation question

Registering PHP aggregates through createAggregate() / sqliteCreateAggregate() looks natural next to the existing UDFs, but one constraint makes the design a maintainers' call: pdo_sqlite passes integers into and out of PHP callbacks as 32 bits (verified on PHP 8.3: an argument of 4294967297 arrives as 1, and a returned 4294967297 comes back as 1). Correct 64-bit results would need either:

  • a translation that passes the argument as text (CAST(expr AS TEXT)) and returns the result as text, plus a decision on how values above 2^63 (for example the empty-set BIT_AND) should surface; or
  • a pure-SQL translation per bit (for example COALESCE(MAX((expr >> n) & 1), 0) << n summed over the 64 bits for BIT_OR), which is exact but large.

A PHP aggregate limited to 32-bit values would cover common flag columns, but would silently return wrong results for wider ones, so I haven't proposed one. Happy to contribute a PR for whichever direction you prefer.

Found while running WooCommerce on WordPress Playground.

Use of AI

This report was prepared with Claude Code.

Ngôn ngữ chính
PHP
Star
362
Fork
69
Merge trung bình
3 ngày 11 giờ
Pull request đã merge (30 ngày)
12

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.

  • Không có Dockerfile hay tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

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 WordPress/sqlite-database-integration

Tất cả issue của WordPress/sqlite-database-integration

Issue tương tự

Thêm issue về PHP

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.