List Equal returns null when either list contains a null element

Aperta Adatta ai principianti
#407 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
backend

Direzione di ricerca

Il bug si trova nel ramo [object Array] di equals in src/util/comparison.ts, che restituisce null quando uno dei due array contiene un elemento null o undefined prima di confrontare qualsiasi cosa. Leggi prima quel ramo, poi la tabella dei risultati attesi nell'issue. È completato quando { null, 1, 2, 3 } = { null, 1, 2, 3 } e { 1, null } = { 1, null } restituiscono true, { 1, null } = { 2, null } restituisce false e l'esecuzione di test-server è coerente.

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

Descrizione

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.

Lingua principale
JavaScript
Stelle
86
Fork
40
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

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 cqframework/cql-execution

Tutte le issue di cqframework/cql-execution

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.