Null in FME 2014: Magnitude Relationship

(FME 2014 Beta build 14223)

Happy New Year!
I'll continue to explore the <null> world. My first question in this year is:
Are there differences in magnitude among "nothing" values - <null>, <empty> and <missing>?

The following image is the result of testing with the Sorter. Each input feature has an attribute named "value" which holds <null> or <empty>, or is missing the attribute (i.e. <missing>), and "index" attribute indicates the input order.
Left table shows the input order; right table shows the result of sorting by "value". As the image showing, the Sorter had no influences on the order of features; it seems that there is no difference in magnitude among them, at least in sorting.

Then, I tried cases that there are features having "non-nothing" value as the attribute.

The result of Alphabetic ascending sorting is like this image.
All the "nothing" values is less than any "non-nothing" value. It's as expected.

The next image shows the result of Numeric ascending sorting.
All the "nothing" values seems to be treated as equivalent to 0 in numeric sorting.

The results are similar to the result of sorting non-empty values and empty strings in FME 2013.
I think the Sorter is keeping logical consistency with the previous version and other transformers - e.g. the Tester etc.. But the behavior especially in numeric sorting may look strange intuitively. There would be some cases in which we should mind that.

2014-01-06: The help documentation on the Sorter in FME 2014 (build 14223) describes like this.
"In Alphabetic mode, missing and null attribute values are treated as the empty string when they are sorted. In Numeric mode, non-numeric attribute values are treated as the value 0 when they are sorted. For example, missing, null, the empty string, and the string "apple" are all treated as the value 0 in Numeric mode."

Tip: If it's necessary to distinguish each "nothing" type in sorting, create another attribute which represents the type of value, so that features can be sorted by the type and value.

No comments:

Post a Comment