Indexing only when RDD has data