private boolean isSqlCountCheck(final HiveFilter filter) {
    // look at hivesubqueryremoverule to see how is this filter created
    if(filter.getCondition() instanceof RexCall) {
      final RexCall condition = (RexCall)filter.getCondition();
      return condition.getOperator().getName().equals("sq_count_check");
    }
    return false;
  }
Planner rule that removes UDF sq_count_check from a plan if
 1) either group by keys in a subquery are constant and there is no windowing or grouping sets
 2) OR there are no group by keys but only aggregate
 Both of the above case will produce at most one row, therefore it is safe to remove sq_count_check
   which was introduced earlier in the plan to ensure that this condition is met at run time
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRemoveSqCountCheck.java