/**
   * This test simulates a join of a big left side with a small right side inside of an iteration,
   * where the small side is on a static path. Currently the best execution plan is a
   * HYBRIDHASH_BUILD_SECOND_CACHED, where the small side is hashed and cached. This test also makes
   * sure that all relevant plans are correctly enumerated by the optimizer.
   */
  @Test
  public void testCorrectChoosing() {
    try {

      Plan plan = getTestPlanRightStatic("");

      SourceCollectorVisitor sourceCollector = new SourceCollectorVisitor();
      plan.accept(sourceCollector);

      for (GenericDataSourceBase<?, ?> s : sourceCollector.getSources()) {
        if (s.getName().equals("bigFile")) {
          this.setSourceStatistics(s, 10000000, 1000);
        } else if (s.getName().equals("smallFile")) {
          this.setSourceStatistics(s, 100, 100);
        }
      }

      OptimizedPlan oPlan = compileNoStats(plan);

      OptimizerPlanNodeResolver resolver = getOptimizerPlanNodeResolver(oPlan);
      DualInputPlanNode innerJoin = resolver.getNode("DummyJoiner");

      // verify correct join strategy
      assertEquals(DriverStrategy.HYBRIDHASH_BUILD_SECOND_CACHED, innerJoin.getDriverStrategy());
      assertEquals(TempMode.NONE, innerJoin.getInput1().getTempMode());
      assertEquals(TempMode.NONE, innerJoin.getInput2().getTempMode());

      new JobGraphGenerator().compileJobGraph(oPlan);
    } catch (Exception e) {
      System.err.println(e.getMessage());
      e.printStackTrace();
      fail("Test errored: " + e.getMessage());
    }
  }
Exemplo n.º 2
0
  protected GenericDataSourceBase<OUT, ?> translateToDataFlow() {
    String name =
        this.name != null
            ? this.name
            : "at " + dataSourceLocationName + " (" + inputFormat.getClass().getName() + ")";
    if (name.length() > 150) {
      name = name.substring(0, 150);
    }

    @SuppressWarnings({"unchecked", "rawtypes"})
    GenericDataSourceBase<OUT, ?> source =
        new GenericDataSourceBase(this.inputFormat, new OperatorInformation<OUT>(getType()), name);
    source.setParallelism(parallelism);
    if (this.parameters != null) {
      source.getParameters().addAll(this.parameters);
    }
    if (this.splitDataProperties != null) {
      source.setSplitDataProperties(this.splitDataProperties);
    }
    return source;
  }