I believe that for HadoopyShardSpecs, the shardNum should be unique across the entire run. In this code it's just going to be the same as "i". So shardCount should be initialized outside the intervals loop.