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

...sion trees. @jkbradley @mengxr @chouqin Please review this.
Will do. I used it because spire was included somehow (maybe one of the dependent packages use it).