Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
ned_blog
8 - Asteroid

It's been a long time since our last blog post. The core team is extremely busy working towards Alteryx 5.0. I hesitate to give an exact date, but we are getting very close to a code freeze with a release a few weeks after that.

 

One of the issues that has come up in our testing is comparisons to NULLs in formulas. For the purposes of simplicity, we will be focusing on numbers, but strings have all the same issues and produce the same results.

 

Think about the following examples:

 

1<Null()
0<Null()
-1<Null()
Null()==Null()
Null()<Null()
Null()<=Null()

 

In the past, we made the decision that Null()==Null() should be true. Without that being true, it makes it difficult to compare streams of data. Many people would argue that Null()!=Null() and in an ideal sense, I would tend to agree with them. The problem is that 2 different fields can be Null() for different reasons and may not be equal in any real sense. The problem with ideals is that they aren't always intuitive. Users expect to be able to compare fields from 2 different data streams for equality.

 

Implementing some Platonic ideal of "right" that confuses users never helps.

 

We recently found some bugs in the <, <=, > and <= operators with regards to Null() and we were forced to make the decision that nothing is greater or less Null(). If there is a Null() on either side of a < or >, than the answer is false. Clearly Null()<Null() is also false. With <= and >=, if there is a Null() on either side, the only way it can be true is if there is a Null() on the other side - because Null()==Null().

 

It does get weird though. If 5<Null() is false and 5>Null() is false, doesn't that imply the 5==Null()! Obviously having Null() values puts the comparisons outside the normal rules of logic. Another weird one: Null()==(Null()+1) Since (Null()+1) results in Null(), the result is true. Another argument that Null()==Null() should probably be false in an ideal world. Sometimes you have to compromise and be less "right" to give users what they want.