Corrected the code that finds number of chains in distributed_spark db