I did think about this, internally it is represented as tree. So it will not be traverse 100 and append. Also this is one time effort, will happen only while initializing SparkContext.