Today, I faced a very strange problem. I was joining two tables using the Joiner node and I realized two rows kept not joining despite the fact their joining columns had the same values. I couldn’t figure out what was wrong. It was like this example.
The Joiner Node’s settings:
And now. Surprise. The Joiner Node’s result:
And I’m pretty sure the last five rows should have got joined with the third row because the bottom_id values 5 from the bottom table ire equal to the top_id value 5 from the top table.
So what’s wrong. Types. But the Joiner Node always complains about type-mismatch (and it insists matching int and log values is a type-mismatch) and more over the tables joined up to some extend, so type can’t be the reason.
Unless it is the reason.
Let’s see the whole workflow:
There is a Rule Engine node in the worklow which is configured this way:
Please notice that an Integer is the assumed type of the result of the first row of the Expression. Well, this made me pretty clear what was wrong with my workflow.
But let’s see the Node’s result:
The column bottom_id is still indicated as of type Long. But I’m sure the KNIME works internally with the cells I tagged with blue collor as if their were of Integer type so it does not match them with the appropriate value from the other table in the Joiner Node.
Well, this was creepy and it took some time to investigate.
The scary thing is KNIME has an underlying logic or magic it uses to decide what to do with cells of different type or different origins. You can do an experiment. Do have a table with a long cell. Use the Table Row to Variable node to get a Flow Variable from the Long cell. Now you can see you don’t see the variable in Flow Variable List area of a Rule Engine Node. So the variable is of type Int but KNIME knows it was made of Long cell and does not offer the variable here. I spent a portion of time figuring out this. It’s magic.
From the point of view of this topic I tend to state a work with long values is often not very convenient. Realy, there are not many nodes capable of work with cells of type Long. Let’s take Math Formula. It’s result is either Double or Integer if you choose that option. But not Long. The Rule Engine Node is another example.