Esempio n. 1
0
  /**
   * 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() + "\""));
    }
  }
Esempio n. 2
0
  /**
   * Check if the distinct node is pushed-down in the given plan.
   *
   * @param np The generated plan
   * @param isMultiPart Whether or not the plan is distributed
   */
  private void checkPushedDownDistinct(List<AbstractPlanNode> pn, boolean isMultiPart) {
    assertTrue(pn.size() > 0);

    AbstractPlanNode p = pn.get(0).getChild(0).getChild(0);
    assertTrue(p instanceof DistinctPlanNode);
    assertTrue(p.toJSONString().contains("\"DISTINCT\""));

    if (isMultiPart) {
      assertTrue(pn.size() == 2);
      p = pn.get(1).getChild(0);
      assertTrue(p instanceof DistinctPlanNode);
      assertTrue(p.toJSONString().contains("\"DISTINCT\""));
    }
  }
 public void testEng585Plan() {
   AbstractPlanNode pn = null;
   pn =
       compile(
           "select max(s.int2) as foo from s, t where s.s_pk = t.s_pk and t.t_pk1 = ?;", 1, true);
   if (pn != null) {
     System.out.println(pn.toJSONString());
   }
 }