Reference the output of a calculated column in Hive SQL Reference the output of a calculated column in Hive SQL hadoop hadoop

Reference the output of a calculated column in Hive SQL


I initially thought that it would help to first compute the Sum of all elements until each rank and then fix the values somehow using negative elements.

However, one big negative that would zero the B column will carry forward in the sum and will make all following elements negative.

It's as Gordon commented - 0 is max in the calculation =MAX(0,B1+A2) depends on the previous location where it happened and it seems to be impossible to compute them in advance analytically.