SPARK-3580: New public method for RDD's to have consistent way of obtain...

...ing the number of RDD partitions across languages.


yeah I can clean this up along with the other style issue on merge.