Skip to content

Distinct on a list of all nulls does not return a list but a single null #951

@bryantaustin13

Description

@bryantaustin13

To dupe:
Run this test:

<?xml version="1.0" encoding="utf-8"?>
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://hl7.org/fhirpath/tests" xsi:schemaLocation="http://hl7.org/fhirpath/tests ../../testSchema/testSchema.xsd"
	   name="CqlListOperatorsTest">
	<capability code="interval-operators"/>
	<group name="SingleTest" version="1.0">
		<test name="DistinctNullNullNull" version="1.0">
			<expression>distinct { null, null, null}</expression>
			<output>{ null }</output>
		</test>
	</group>
</tests>

Actual return: null

I am wondering if the serialization is causing the problem.
Instead of a list of null like a single null is returned. According to https://cql.hl7.org/2017Jul/09-b-cqlreference.html?#distinct
"The distinct operator returns the given list with duplicates eliminated."
The description is a little ambiguous, because it also states "If the argument is null, the result is null."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions