List Equal returns null when either list contains a null element

Đang mở Phù hợp với người mới
#407 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript
Lĩnh vực
backend

Hướng nghiên cứu

Lỗi nằm ở nhánh [object Array] của equals trong src/util/comparison.ts, nhánh này trả về null khi một trong hai mảng có phần tử null hoặc undefined trước khi so sánh bất cứ thứ gì. Hãy đọc nhánh đó trước, sau đó đọc bảng kết quả mong đợi trong issue. Hoàn thành khi { null, 1, 2, 3 } = { null, 1, 2, 3 } và { 1, null } = { 1, null } trả về true, { 1, null } = { 2, null } trả về false, và kết quả chạy test-server khớp với các kết quả trên.

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

Mô tả

Summary

Equal for lists (1.5.3 and 2.0):

For list types, this means that equality returns true if and only if the lists contain elements of the same type, have the same number of elements, and for each element in the lists, in order, the elements are equal using equality semantics, with the exception that null elements are considered equal.

The spec's example is define "ListEqualIsTrue": { null, 1, 2, 3 } = { null, 1, 2, 3 }.

Expression cql-execution Spec Java engine 5.8.0
{ null, 1, 2, 3 } = { null, 1, 2, 3 } null true true
{ 1, null } = { 1, null } null true true
{ 1, null } = { 2, null } null false false

Cause

In equals (src/util/comparison.ts), the [object Array] branch returns null if either array contains null or undefined, before it compares the items. It should compare them pairwise, treating two nulls as equal.

Environment

cql-execution master e8096c6, through test-server (the build has two unrelated Quantity modulo commits on top). The Java engine column is HAPI FHIR 9.0.0 with clinical-reasoning 4.17.0, through $cql.

Ngôn ngữ chính
JavaScript
Star
86
Fork
40
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

  • Không có Dockerfile hay tệp Docker Compose
  • 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 cqframework/cql-execution

Tất cả issue của cqframework/cql-execution

Issue tương tự

Thêm issue về JavaScript

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.