fix non-distributed group-by plan, fix flaky tests