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

...sion trees. @jkbradley @mengxr @chouqin Please review this.
I second that, especially if it eliminates the dependence on spire (since spire is not used elsewhere in Spark).