Java Code Examples for org.apache.flink.optimizer.plan.DualInputPlanNode#getDriverStrategy()

The following examples show how to use org.apache.flink.optimizer.plan.DualInputPlanNode#getDriverStrategy() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RelationalQueryCompilerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private boolean checkHashJoinStrategies(DualInputPlanNode join, SingleInputPlanNode reducer, boolean buildFirst) {
	if ((buildFirst && DriverStrategy.HYBRIDHASH_BUILD_FIRST == join.getDriverStrategy()) ||
		(!buildFirst && DriverStrategy.HYBRIDHASH_BUILD_SECOND == join.getDriverStrategy())) {

		// driver keys
		Assert.assertEquals(set0, join.getKeysForInput1());
		Assert.assertEquals(set0, join.getKeysForInput2());

		// local strategies
		Assert.assertEquals(LocalStrategy.NONE, join.getInput1().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.NONE, join.getInput2().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.COMBININGSORT, reducer.getInput().getLocalStrategy());

		// local strategy keys
		Assert.assertEquals(set01, reducer.getInput().getLocalStrategyKeys());
		Assert.assertEquals(set01, reducer.getKeys(0));
		Assert.assertTrue(Arrays.equals(reducer.getInput().getLocalStrategySortOrder(), reducer.getSortOrders(0)));
		return true;
	} else {
		return false;
	}
}
 
Example 2
Source File: RelationalQueryCompilerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private boolean checkBroadcastMergeJoin(DualInputPlanNode join, SingleInputPlanNode reducer) {
	if (DriverStrategy.INNER_MERGE == join.getDriverStrategy()) {
		// driver keys
		Assert.assertEquals(set0, join.getKeysForInput1());
		Assert.assertEquals(set0, join.getKeysForInput2());

		// local strategies
		Assert.assertEquals(LocalStrategy.SORT, join.getInput1().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.SORT, join.getInput2().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.COMBININGSORT, reducer.getInput().getLocalStrategy());

		// local strategy keys
		Assert.assertEquals(set0, join.getInput1().getLocalStrategyKeys());
		Assert.assertEquals(set0, join.getInput2().getLocalStrategyKeys());
		Assert.assertTrue(Arrays.equals(join.getInput1().getLocalStrategySortOrder(), join.getInput2().getLocalStrategySortOrder()));
		Assert.assertEquals(set01, reducer.getInput().getLocalStrategyKeys());
		Assert.assertEquals(set01, reducer.getKeys(0));
		Assert.assertTrue(Arrays.equals(reducer.getInput().getLocalStrategySortOrder(), reducer.getSortOrders(0)));
		return true;
	} else {
		return false;
	}
}
 
Example 3
Source File: RelationalQueryCompilerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private boolean checkRepartitionMergeJoin(DualInputPlanNode join, SingleInputPlanNode reducer) {
	if (DriverStrategy.INNER_MERGE == join.getDriverStrategy()) {
		// driver keys
		Assert.assertEquals(set0, join.getKeysForInput1());
		Assert.assertEquals(set0, join.getKeysForInput2());

		// local strategies
		Assert.assertEquals(LocalStrategy.SORT, join.getInput1().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.SORT, join.getInput2().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.NONE, reducer.getInput().getLocalStrategy());

		// local strategy keys
		Assert.assertEquals(set01, join.getInput1().getLocalStrategyKeys());
		Assert.assertEquals(set0, join.getInput2().getLocalStrategyKeys());
		Assert.assertTrue(join.getInput1().getLocalStrategySortOrder()[0] == join.getInput2().getLocalStrategySortOrder()[0]);
		Assert.assertEquals(set01, reducer.getKeys(0));
		Assert.assertTrue(Arrays.equals(join.getInput1().getLocalStrategySortOrder(), reducer.getSortOrders(0)));
		return true;
	} else {
		return false;
	}
}
 
Example 4
Source File: RelationalQueryCompilerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private boolean checkHashJoinStrategies(DualInputPlanNode join, SingleInputPlanNode reducer, boolean buildFirst) {
	if ((buildFirst && DriverStrategy.HYBRIDHASH_BUILD_FIRST == join.getDriverStrategy()) ||
		(!buildFirst && DriverStrategy.HYBRIDHASH_BUILD_SECOND == join.getDriverStrategy())) {

		// driver keys
		Assert.assertEquals(set0, join.getKeysForInput1());
		Assert.assertEquals(set0, join.getKeysForInput2());

		// local strategies
		Assert.assertEquals(LocalStrategy.NONE, join.getInput1().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.NONE, join.getInput2().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.COMBININGSORT, reducer.getInput().getLocalStrategy());

		// local strategy keys
		Assert.assertEquals(set01, reducer.getInput().getLocalStrategyKeys());
		Assert.assertEquals(set01, reducer.getKeys(0));
		Assert.assertTrue(Arrays.equals(reducer.getInput().getLocalStrategySortOrder(), reducer.getSortOrders(0)));
		return true;
	} else {
		return false;
	}
}
 
Example 5
Source File: RelationalQueryCompilerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private boolean checkBroadcastMergeJoin(DualInputPlanNode join, SingleInputPlanNode reducer) {
	if (DriverStrategy.INNER_MERGE == join.getDriverStrategy()) {
		// driver keys
		Assert.assertEquals(set0, join.getKeysForInput1());
		Assert.assertEquals(set0, join.getKeysForInput2());

		// local strategies
		Assert.assertEquals(LocalStrategy.SORT, join.getInput1().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.SORT, join.getInput2().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.COMBININGSORT, reducer.getInput().getLocalStrategy());

		// local strategy keys
		Assert.assertEquals(set0, join.getInput1().getLocalStrategyKeys());
		Assert.assertEquals(set0, join.getInput2().getLocalStrategyKeys());
		Assert.assertTrue(Arrays.equals(join.getInput1().getLocalStrategySortOrder(), join.getInput2().getLocalStrategySortOrder()));
		Assert.assertEquals(set01, reducer.getInput().getLocalStrategyKeys());
		Assert.assertEquals(set01, reducer.getKeys(0));
		Assert.assertTrue(Arrays.equals(reducer.getInput().getLocalStrategySortOrder(), reducer.getSortOrders(0)));
		return true;
	} else {
		return false;
	}
}
 
Example 6
Source File: RelationalQueryCompilerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private boolean checkRepartitionMergeJoin(DualInputPlanNode join, SingleInputPlanNode reducer) {
	if (DriverStrategy.INNER_MERGE == join.getDriverStrategy()) {
		// driver keys
		Assert.assertEquals(set0, join.getKeysForInput1());
		Assert.assertEquals(set0, join.getKeysForInput2());

		// local strategies
		Assert.assertEquals(LocalStrategy.SORT, join.getInput1().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.SORT, join.getInput2().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.NONE, reducer.getInput().getLocalStrategy());

		// local strategy keys
		Assert.assertEquals(set01, join.getInput1().getLocalStrategyKeys());
		Assert.assertEquals(set0, join.getInput2().getLocalStrategyKeys());
		Assert.assertTrue(join.getInput1().getLocalStrategySortOrder()[0] == join.getInput2().getLocalStrategySortOrder()[0]);
		Assert.assertEquals(set01, reducer.getKeys(0));
		Assert.assertTrue(Arrays.equals(join.getInput1().getLocalStrategySortOrder(), reducer.getSortOrders(0)));
		return true;
	} else {
		return false;
	}
}
 
Example 7
Source File: RelationalQueryCompilerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private boolean checkHashJoinStrategies(DualInputPlanNode join, SingleInputPlanNode reducer, boolean buildFirst) {
	if ((buildFirst && DriverStrategy.HYBRIDHASH_BUILD_FIRST == join.getDriverStrategy()) ||
		(!buildFirst && DriverStrategy.HYBRIDHASH_BUILD_SECOND == join.getDriverStrategy())) {

		// driver keys
		Assert.assertEquals(set0, join.getKeysForInput1());
		Assert.assertEquals(set0, join.getKeysForInput2());

		// local strategies
		Assert.assertEquals(LocalStrategy.NONE, join.getInput1().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.NONE, join.getInput2().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.COMBININGSORT, reducer.getInput().getLocalStrategy());

		// local strategy keys
		Assert.assertEquals(set01, reducer.getInput().getLocalStrategyKeys());
		Assert.assertEquals(set01, reducer.getKeys(0));
		Assert.assertTrue(Arrays.equals(reducer.getInput().getLocalStrategySortOrder(), reducer.getSortOrders(0)));
		return true;
	} else {
		return false;
	}
}
 
Example 8
Source File: RelationalQueryCompilerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private boolean checkBroadcastMergeJoin(DualInputPlanNode join, SingleInputPlanNode reducer) {
	if (DriverStrategy.INNER_MERGE == join.getDriverStrategy()) {
		// driver keys
		Assert.assertEquals(set0, join.getKeysForInput1());
		Assert.assertEquals(set0, join.getKeysForInput2());

		// local strategies
		Assert.assertEquals(LocalStrategy.SORT, join.getInput1().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.SORT, join.getInput2().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.COMBININGSORT, reducer.getInput().getLocalStrategy());

		// local strategy keys
		Assert.assertEquals(set0, join.getInput1().getLocalStrategyKeys());
		Assert.assertEquals(set0, join.getInput2().getLocalStrategyKeys());
		Assert.assertTrue(Arrays.equals(join.getInput1().getLocalStrategySortOrder(), join.getInput2().getLocalStrategySortOrder()));
		Assert.assertEquals(set01, reducer.getInput().getLocalStrategyKeys());
		Assert.assertEquals(set01, reducer.getKeys(0));
		Assert.assertTrue(Arrays.equals(reducer.getInput().getLocalStrategySortOrder(), reducer.getSortOrders(0)));
		return true;
	} else {
		return false;
	}
}
 
Example 9
Source File: RelationalQueryCompilerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private boolean checkRepartitionMergeJoin(DualInputPlanNode join, SingleInputPlanNode reducer) {
	if (DriverStrategy.INNER_MERGE == join.getDriverStrategy()) {
		// driver keys
		Assert.assertEquals(set0, join.getKeysForInput1());
		Assert.assertEquals(set0, join.getKeysForInput2());

		// local strategies
		Assert.assertEquals(LocalStrategy.SORT, join.getInput1().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.SORT, join.getInput2().getLocalStrategy());
		Assert.assertEquals(LocalStrategy.NONE, reducer.getInput().getLocalStrategy());

		// local strategy keys
		Assert.assertEquals(set01, join.getInput1().getLocalStrategyKeys());
		Assert.assertEquals(set0, join.getInput2().getLocalStrategyKeys());
		Assert.assertTrue(join.getInput1().getLocalStrategySortOrder()[0] == join.getInput2().getLocalStrategySortOrder()[0]);
		Assert.assertEquals(set01, reducer.getKeys(0));
		Assert.assertTrue(Arrays.equals(join.getInput1().getLocalStrategySortOrder(), reducer.getSortOrders(0)));
		return true;
	} else {
		return false;
	}
}
 
Example 10
Source File: JobGraphGenerator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private JobVertex createDualInputVertex(DualInputPlanNode node) throws CompilerException {
	final String taskName = node.getNodeName();
	final DriverStrategy ds = node.getDriverStrategy();
	final JobVertex vertex = new JobVertex(taskName);
	final TaskConfig config = new TaskConfig(vertex.getConfiguration());
	vertex.setResources(node.getMinResources(), node.getPreferredResources());
	vertex.setInvokableClass( (this.currentIteration != null && node.isOnDynamicPath()) ? IterationIntermediateTask.class : BatchTask.class);
	
	// set user code
	config.setStubWrapper(node.getProgramOperator().getUserCodeWrapper());
	config.setStubParameters(node.getProgramOperator().getParameters());
	
	// set the driver strategy
	config.setDriver(ds.getDriverClass());
	config.setDriverStrategy(ds);
	if (node.getComparator1() != null) {
		config.setDriverComparator(node.getComparator1(), 0);
	}
	if (node.getComparator2() != null) {
		config.setDriverComparator(node.getComparator2(), 1);
	}
	if (node.getPairComparator() != null) {
		config.setDriverPairComparator(node.getPairComparator());
	}
	
	// assign memory, file-handles, etc.
	assignDriverResources(node, config);
	return vertex;
}
 
Example 11
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 5 votes vote down vote up
private JobVertex createDualInputVertex(DualInputPlanNode node) throws CompilerException {
	final String taskName = node.getNodeName();
	final DriverStrategy ds = node.getDriverStrategy();
	final JobVertex vertex = new JobVertex(taskName);
	final TaskConfig config = new TaskConfig(vertex.getConfiguration());
	vertex.setResources(node.getMinResources(), node.getPreferredResources());
	vertex.setInvokableClass( (this.currentIteration != null && node.isOnDynamicPath()) ? IterationIntermediateTask.class : BatchTask.class);
	
	// set user code
	config.setStubWrapper(node.getProgramOperator().getUserCodeWrapper());
	config.setStubParameters(node.getProgramOperator().getParameters());
	
	// set the driver strategy
	config.setDriver(ds.getDriverClass());
	config.setDriverStrategy(ds);
	if (node.getComparator1() != null) {
		config.setDriverComparator(node.getComparator1(), 0);
	}
	if (node.getComparator2() != null) {
		config.setDriverComparator(node.getComparator2(), 1);
	}
	if (node.getPairComparator() != null) {
		config.setDriverPairComparator(node.getPairComparator());
	}
	
	// assign memory, file-handles, etc.
	assignDriverResources(node, config);
	return vertex;
}
 
Example 12
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 5 votes vote down vote up
private JobVertex createDualInputVertex(DualInputPlanNode node) throws CompilerException {
	final String taskName = node.getNodeName();
	final DriverStrategy ds = node.getDriverStrategy();
	final JobVertex vertex = new JobVertex(taskName);
	final TaskConfig config = new TaskConfig(vertex.getConfiguration());
	vertex.setResources(node.getMinResources(), node.getPreferredResources());
	vertex.setInvokableClass( (this.currentIteration != null && node.isOnDynamicPath()) ? IterationIntermediateTask.class : BatchTask.class);
	
	// set user code
	config.setStubWrapper(node.getProgramOperator().getUserCodeWrapper());
	config.setStubParameters(node.getProgramOperator().getParameters());
	
	// set the driver strategy
	config.setDriver(ds.getDriverClass());
	config.setDriverStrategy(ds);
	if (node.getComparator1() != null) {
		config.setDriverComparator(node.getComparator1(), 0);
	}
	if (node.getComparator2() != null) {
		config.setDriverComparator(node.getComparator2(), 1);
	}
	if (node.getPairComparator() != null) {
		config.setDriverPairComparator(node.getPairComparator());
	}
	
	// assign memory, file-handles, etc.
	assignDriverResources(node, config);
	return vertex;
}