code: func (er *expressionRewriter) popExistsSubPlan(p LogicalPlan) LogicalPlan {
  out:
  	for {
  		switch plan := p.(type) {
  		// This can be removed when in exists clause,
  		// e.g. exists(select count(*) from t order by a) is equal to exists t.
  		case *LogicalProjection, *LogicalSort:
  			p = p.Children()[0]
  		case *LogicalAggregation:
  			if len(plan.GroupByItems) == 0 {
  				p = LogicalTableDual{RowCount: 1}.Init(er.ctx)
  				break out
  			}
  			p = p.Children()[0]
  		default:
  			break out
  		}
  	}
  	return p
  }
docs: // popExistsSubPlan will remove the useless plan in exist's child.
  // See comments inside the method for more details.