[SPARK-3161][MLLIB] Adding a node Id caching mechanism for training deci...

...sion trees. @jkbradley @mengxr @chouqin Please review this.
I think that this is fine as long as you get relatively balanced trees, since the tree would be extremely big by the time you reach level 30.

However, based on my experience, the problem in practice is that you often get unbalanced trees. E.g., when I train on 60,000 sample mnist without pruning, I often got a tree with close to ~100 level deep, even though the number of nodes was only around 5000 or so.

I will do it the way you suggested by simply calling Node.leftChildId, Node.rightChildId.

For future, though, I think that a relatively easy way to do this might be by assigning Ids in a FIFO fashion (keepLastAssignedId and +1 for every child node that comes in). It will likely lead to a bit more complicated code, but I think that it'll be easier than removing node Ids entirely.