Semantics of cast/comparison/arithmetics involving null

Bug #1041445 reported by Chris Hillery
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Released
High
Ghislain Fourny

Bug Description

This is, I think, a bug / omission from the JSONiq spec.

There is no easy way to compare an item to see if it is null. You can use "instance of jdm:null", but you have to declare the jdm namespace - probably it should be pre-declared. However, IMHO at least, it would make much more sense to be able to do

where $o ne jn:null()

Unfortunately this throws an error if $o is not atomic.

Comparison and arithmetic on null is not defined by the spec. IMHO, the correct answer for comparison is that any type should be comparable to null, and anything except null should return false.

Dana's opinion is that when performing arithmetic on null, any operation should return null. ie, null + 1 = null, etc.

Tags: jsoniq

Related branches

Chris Hillery (ceejatec)
Changed in zorba:
assignee: nobody → Ghislain Fourny (gislenius)
status: New → Confirmed
importance: Undecided → Medium
Till Westmann (tillw)
tags: added: jsoniq
Revision history for this message
Ghislain Fourny (gislenius) wrote :

The specification now specifies behavior for:
- casting to and from null
- arithmetic operations involving null (meeting the above constraints)
- value comparison involving nulls (meeting the above constraints)
- general comparison involving nulls

If we have consensus, it needs to be implemented.

summary: - Checking for null in JSONiq
+ Semantics of cast/comparison/arithmetics involving null
Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

According to the latest discussion, we have changed the semantics (again).

Essentially, null should always behave like the empty sequence (for cast and comparisons). That is, instance of jn:null() will be one way to check if an item is the null item. In addition, we will introduce a new function jn:is-null() which essentially does the same thing.

Changed in zorba:
milestone: none → 2.7
importance: Medium → High
Changed in zorba:
status: Confirmed → In Progress
Changed in zorba:
status: In Progress → Fix Committed
Changed in zorba:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.