Details
Description
CoalesceExec calls `child.execute()` in the if condition and throws away the results, then calls `child.execute()` again in the else condition. This could cause a section of the plan to be executed twice.
protected override def doExecute(): RDD[InternalRow] = { if (numPartitions == 1 && child.execute().getNumPartitions < 1) { // Make sure we don't output an RDD with 0 partitions, when claiming that we have a // `SinglePartition`. new CoalesceExec.EmptyRDDWithPartitions(sparkContext, numPartitions) } else { child.execute().coalesce(numPartitions, shuffle = false) } }