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

...sion trees. @jkbradley @mengxr @chouqin Please review this.
Just a suggestion, we can remove this `data` field from this class because it is only used for  the `updateNodeIndices` function. The name `NodeIdCache` will make more sense in this way.
We can call `updateNodeIndices` with a `RDD[BaggedPoint[TreePoint]]` explicitly.

By the way, can you give a meaningful name to `cur`( such as `nodeIdsForInstances`)?