All code changes in this PR is to make this single testcase pass.
Example of ZEPPELIN-106 is general explanation of the problem.

Maybe better to add one more, if - else - end case.