/** * Check if the aggregate node is pushed-down in the given plan. If the pushDownTypes is null, it * assumes that the aggregate node should NOT be pushed-down. * * @param np The generated plan * @param isMultiPart Whether or not the plan is distributed * @param aggTypes The expected aggregate types for the original aggregate node. * @param pushDownTypes The expected aggregate types for the top aggregate node after pushing the * original aggregate node down. */ private void checkPushedDown( List<AbstractPlanNode> pn, boolean isMultiPart, ExpressionType[] aggTypes, ExpressionType[] pushDownTypes) { assertTrue(pn.size() > 0); AbstractPlanNode p = pn.get(0).getChild(0); assertTrue(p instanceof AggregatePlanNode); String fragmentString = p.toJSONString(); ExpressionType[] topTypes = (pushDownTypes != null) ? pushDownTypes : aggTypes; for (ExpressionType type : topTypes) { assertTrue(fragmentString.contains("\"AGGREGATE_TYPE\":\"" + type.toString() + "\"")); } if (isMultiPart) { assertTrue(pn.size() == 2); p = pn.get(1).getChild(0); } else { p = p.getChild(0); } if (pushDownTypes == null) { assertTrue(p instanceof AbstractScanPlanNode); return; } assertTrue(p instanceof AggregatePlanNode); fragmentString = p.toJSONString(); for (ExpressionType type : aggTypes) { assertTrue(fragmentString.contains("\"AGGREGATE_TYPE\":\"" + type.toString() + "\"")); } }