Java Code Examples for org.apache.flink.optimizer.dataproperties.RequestedGlobalProperties#setCustomPartitioned()

The following examples show how to use org.apache.flink.optimizer.dataproperties.RequestedGlobalProperties#setCustomPartitioned() . 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: PartitionNode.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
protected List<RequestedGlobalProperties> createPossibleGlobalProperties() {
	RequestedGlobalProperties rgps = new RequestedGlobalProperties();
	
	switch (this.pMethod) {
	case HASH:
		rgps.setHashPartitioned(this.keys);
		break;
	case REBALANCE:
		rgps.setForceRebalancing();
		break;
	case CUSTOM:
		rgps.setCustomPartitioned(this.keys, this.customPartitioner);
		break;
	case RANGE:
		rgps.setRangePartitioned(ordering, distribution);
		break;
	default:
		throw new IllegalArgumentException("Invalid partition method");
	}
	
	return Collections.singletonList(rgps);
}
 
Example 2
Source File: PartitionNode.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
protected List<RequestedGlobalProperties> createPossibleGlobalProperties() {
	RequestedGlobalProperties rgps = new RequestedGlobalProperties();
	
	switch (this.pMethod) {
	case HASH:
		rgps.setHashPartitioned(this.keys);
		break;
	case REBALANCE:
		rgps.setForceRebalancing();
		break;
	case CUSTOM:
		rgps.setCustomPartitioned(this.keys, this.customPartitioner);
		break;
	case RANGE:
		rgps.setRangePartitioned(ordering, distribution);
		break;
	default:
		throw new IllegalArgumentException("Invalid partition method");
	}
	
	return Collections.singletonList(rgps);
}
 
Example 3
Source File: PartitionNode.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
protected List<RequestedGlobalProperties> createPossibleGlobalProperties() {
	RequestedGlobalProperties rgps = new RequestedGlobalProperties();
	
	switch (this.pMethod) {
	case HASH:
		rgps.setHashPartitioned(this.keys);
		break;
	case REBALANCE:
		rgps.setForceRebalancing();
		break;
	case CUSTOM:
		rgps.setCustomPartitioned(this.keys, this.customPartitioner);
		break;
	case RANGE:
		rgps.setRangePartitioned(ordering, distribution);
		break;
	default:
		throw new IllegalArgumentException("Invalid partition method");
	}
	
	return Collections.singletonList(rgps);
}
 
Example 4
Source File: ReduceProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected List<RequestedGlobalProperties> createPossibleGlobalProperties() {
	RequestedGlobalProperties props = new RequestedGlobalProperties();
	if (customPartitioner == null) {
		props.setAnyPartitioning(this.keys);
	} else {
		props.setCustomPartitioned(this.keys, this.customPartitioner);
	}
	return Collections.singletonList(props);
}
 
Example 5
Source File: CoGroupDescriptor.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected List<GlobalPropertiesPair> createPossibleGlobalProperties() {

	if (this.customPartitioner == null) {

		// we accept compatible partitionings of any type
		RequestedGlobalProperties partitioned_left_any = new RequestedGlobalProperties();
		RequestedGlobalProperties partitioned_right_any = new RequestedGlobalProperties();
		partitioned_left_any.setAnyPartitioning(this.keys1);
		partitioned_right_any.setAnyPartitioning(this.keys2);

		// add strict hash partitioning of both inputs on their full key sets
		RequestedGlobalProperties partitioned_left_hash = new RequestedGlobalProperties();
		RequestedGlobalProperties partitioned_right_hash = new RequestedGlobalProperties();
		partitioned_left_hash.setHashPartitioned(this.keys1);
		partitioned_right_hash.setHashPartitioned(this.keys2);

		return Arrays.asList(new GlobalPropertiesPair(partitioned_left_any, partitioned_right_any),
				new GlobalPropertiesPair(partitioned_left_hash, partitioned_right_hash));
	}
	else {
		RequestedGlobalProperties partitioned_left = new RequestedGlobalProperties();
		partitioned_left.setCustomPartitioned(this.keys1, this.customPartitioner);

		RequestedGlobalProperties partitioned_right = new RequestedGlobalProperties();
		partitioned_right.setCustomPartitioned(this.keys2, this.customPartitioner);

		return Collections.singletonList(new GlobalPropertiesPair(partitioned_left, partitioned_right));
	}
}
 
Example 6
Source File: ReduceProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected List<RequestedGlobalProperties> createPossibleGlobalProperties() {
	RequestedGlobalProperties props = new RequestedGlobalProperties();
	if (customPartitioner == null) {
		props.setAnyPartitioning(this.keys);
	} else {
		props.setCustomPartitioned(this.keys, this.customPartitioner);
	}
	return Collections.singletonList(props);
}
 
Example 7
Source File: GroupReduceProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected List<RequestedGlobalProperties> createPossibleGlobalProperties() {
	RequestedGlobalProperties props = new RequestedGlobalProperties();
	
	if (customPartitioner == null) {
		props.setAnyPartitioning(this.keys);
	} else {
		props.setCustomPartitioned(this.keys, this.customPartitioner);
	}
	return Collections.singletonList(props);
}
 
Example 8
Source File: GroupReduceWithCombineProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected List<RequestedGlobalProperties> createPossibleGlobalProperties() {
	RequestedGlobalProperties props = new RequestedGlobalProperties();
	if (customPartitioner == null) {
		props.setAnyPartitioning(this.keys);
	} else {
		props.setCustomPartitioned(this.keys, this.customPartitioner);
	}
	return Collections.singletonList(props);
}
 
Example 9
Source File: CoGroupDescriptor.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected List<GlobalPropertiesPair> createPossibleGlobalProperties() {

	if (this.customPartitioner == null) {

		// we accept compatible partitionings of any type
		RequestedGlobalProperties partitioned_left_any = new RequestedGlobalProperties();
		RequestedGlobalProperties partitioned_right_any = new RequestedGlobalProperties();
		partitioned_left_any.setAnyPartitioning(this.keys1);
		partitioned_right_any.setAnyPartitioning(this.keys2);

		// add strict hash partitioning of both inputs on their full key sets
		RequestedGlobalProperties partitioned_left_hash = new RequestedGlobalProperties();
		RequestedGlobalProperties partitioned_right_hash = new RequestedGlobalProperties();
		partitioned_left_hash.setHashPartitioned(this.keys1);
		partitioned_right_hash.setHashPartitioned(this.keys2);

		return Arrays.asList(new GlobalPropertiesPair(partitioned_left_any, partitioned_right_any),
				new GlobalPropertiesPair(partitioned_left_hash, partitioned_right_hash));
	}
	else {
		RequestedGlobalProperties partitioned_left = new RequestedGlobalProperties();
		partitioned_left.setCustomPartitioned(this.keys1, this.customPartitioner);

		RequestedGlobalProperties partitioned_right = new RequestedGlobalProperties();
		partitioned_right.setCustomPartitioned(this.keys2, this.customPartitioner);

		return Collections.singletonList(new GlobalPropertiesPair(partitioned_left, partitioned_right));
	}
}
 
Example 10
Source File: GroupReduceWithCombineProperties.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected List<RequestedGlobalProperties> createPossibleGlobalProperties() {
	RequestedGlobalProperties props = new RequestedGlobalProperties();
	if (customPartitioner == null) {
		props.setAnyPartitioning(this.keys);
	} else {
		props.setCustomPartitioned(this.keys, this.customPartitioner);
	}
	return Collections.singletonList(props);
}
 
Example 11
Source File: GroupReduceProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected List<RequestedGlobalProperties> createPossibleGlobalProperties() {
	RequestedGlobalProperties props = new RequestedGlobalProperties();
	
	if (customPartitioner == null) {
		props.setAnyPartitioning(this.keys);
	} else {
		props.setCustomPartitioned(this.keys, this.customPartitioner);
	}
	return Collections.singletonList(props);
}
 
Example 12
Source File: GroupReduceWithCombineProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected List<RequestedGlobalProperties> createPossibleGlobalProperties() {
	RequestedGlobalProperties props = new RequestedGlobalProperties();
	if (customPartitioner == null) {
		props.setAnyPartitioning(this.keys);
	} else {
		props.setCustomPartitioned(this.keys, this.customPartitioner);
	}
	return Collections.singletonList(props);
}
 
Example 13
Source File: CoGroupDescriptor.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected List<GlobalPropertiesPair> createPossibleGlobalProperties() {

	if (this.customPartitioner == null) {

		// we accept compatible partitionings of any type
		RequestedGlobalProperties partitioned_left_any = new RequestedGlobalProperties();
		RequestedGlobalProperties partitioned_right_any = new RequestedGlobalProperties();
		partitioned_left_any.setAnyPartitioning(this.keys1);
		partitioned_right_any.setAnyPartitioning(this.keys2);

		// add strict hash partitioning of both inputs on their full key sets
		RequestedGlobalProperties partitioned_left_hash = new RequestedGlobalProperties();
		RequestedGlobalProperties partitioned_right_hash = new RequestedGlobalProperties();
		partitioned_left_hash.setHashPartitioned(this.keys1);
		partitioned_right_hash.setHashPartitioned(this.keys2);

		return Arrays.asList(new GlobalPropertiesPair(partitioned_left_any, partitioned_right_any),
				new GlobalPropertiesPair(partitioned_left_hash, partitioned_right_hash));
	}
	else {
		RequestedGlobalProperties partitioned_left = new RequestedGlobalProperties();
		partitioned_left.setCustomPartitioned(this.keys1, this.customPartitioner);

		RequestedGlobalProperties partitioned_right = new RequestedGlobalProperties();
		partitioned_right.setCustomPartitioned(this.keys2, this.customPartitioner);

		return Collections.singletonList(new GlobalPropertiesPair(partitioned_left, partitioned_right));
	}
}
 
Example 14
Source File: ReduceProperties.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected List<RequestedGlobalProperties> createPossibleGlobalProperties() {
	RequestedGlobalProperties props = new RequestedGlobalProperties();
	if (customPartitioner == null) {
		props.setAnyPartitioning(this.keys);
	} else {
		props.setCustomPartitioned(this.keys, this.customPartitioner);
	}
	return Collections.singletonList(props);
}
 
Example 15
Source File: GroupReduceProperties.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected List<RequestedGlobalProperties> createPossibleGlobalProperties() {
	RequestedGlobalProperties props = new RequestedGlobalProperties();
	
	if (customPartitioner == null) {
		props.setAnyPartitioning(this.keys);
	} else {
		props.setCustomPartitioned(this.keys, this.customPartitioner);
	}
	return Collections.singletonList(props);
}
 
Example 16
Source File: AbstractJoinDescriptor.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected List<GlobalPropertiesPair> createPossibleGlobalProperties() {
	ArrayList<GlobalPropertiesPair> pairs = new ArrayList<GlobalPropertiesPair>();
	
	if (repartitionAllowed) {
		// partition both (hash or custom)
		if (this.customPartitioner == null) {

			// we accept compatible partitionings of any type
			RequestedGlobalProperties partitioned_left_any = new RequestedGlobalProperties();
			RequestedGlobalProperties partitioned_right_any = new RequestedGlobalProperties();
			partitioned_left_any.setAnyPartitioning(this.keys1);
			partitioned_right_any.setAnyPartitioning(this.keys2);
			pairs.add(new GlobalPropertiesPair(partitioned_left_any, partitioned_right_any));

			// add strict hash partitioning of both inputs on their full key sets
			RequestedGlobalProperties partitioned_left_hash = new RequestedGlobalProperties();
			RequestedGlobalProperties partitioned_right_hash = new RequestedGlobalProperties();
			partitioned_left_hash.setHashPartitioned(this.keys1);
			partitioned_right_hash.setHashPartitioned(this.keys2);
			pairs.add(new GlobalPropertiesPair(partitioned_left_hash, partitioned_right_hash));
		}
		else {
			RequestedGlobalProperties partitioned_left = new RequestedGlobalProperties();
			partitioned_left.setCustomPartitioned(this.keys1, this.customPartitioner);

			RequestedGlobalProperties partitioned_right = new RequestedGlobalProperties();
			partitioned_right.setCustomPartitioned(this.keys2, this.customPartitioner);

			return Collections.singletonList(new GlobalPropertiesPair(partitioned_left, partitioned_right));
		}
		
		
		RequestedGlobalProperties partitioned1 = new RequestedGlobalProperties();
		if (customPartitioner == null) {
			partitioned1.setAnyPartitioning(this.keys1);
		} else {
			partitioned1.setCustomPartitioned(this.keys1, this.customPartitioner);
		}
		
		RequestedGlobalProperties partitioned2 = new RequestedGlobalProperties();
		if (customPartitioner == null) {
			partitioned2.setAnyPartitioning(this.keys2);
		} else {
			partitioned2.setCustomPartitioned(this.keys2, this.customPartitioner);
		}
		
		pairs.add(new GlobalPropertiesPair(partitioned1, partitioned2));
	}
	
	if (broadcastSecondAllowed) {
		// replicate second
		RequestedGlobalProperties any1 = new RequestedGlobalProperties();
		RequestedGlobalProperties replicated2 = new RequestedGlobalProperties();
		replicated2.setFullyReplicated();
		pairs.add(new GlobalPropertiesPair(any1, replicated2));
	}
	
	if (broadcastFirstAllowed) {
		// replicate first
		RequestedGlobalProperties replicated1 = new RequestedGlobalProperties();
		replicated1.setFullyReplicated();
		RequestedGlobalProperties any2 = new RequestedGlobalProperties();
		pairs.add(new GlobalPropertiesPair(replicated1, any2));
	}
	return pairs;
}
 
Example 17
Source File: AbstractJoinDescriptor.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected List<GlobalPropertiesPair> createPossibleGlobalProperties() {
	ArrayList<GlobalPropertiesPair> pairs = new ArrayList<GlobalPropertiesPair>();
	
	if (repartitionAllowed) {
		// partition both (hash or custom)
		if (this.customPartitioner == null) {

			// we accept compatible partitionings of any type
			RequestedGlobalProperties partitioned_left_any = new RequestedGlobalProperties();
			RequestedGlobalProperties partitioned_right_any = new RequestedGlobalProperties();
			partitioned_left_any.setAnyPartitioning(this.keys1);
			partitioned_right_any.setAnyPartitioning(this.keys2);
			pairs.add(new GlobalPropertiesPair(partitioned_left_any, partitioned_right_any));

			// add strict hash partitioning of both inputs on their full key sets
			RequestedGlobalProperties partitioned_left_hash = new RequestedGlobalProperties();
			RequestedGlobalProperties partitioned_right_hash = new RequestedGlobalProperties();
			partitioned_left_hash.setHashPartitioned(this.keys1);
			partitioned_right_hash.setHashPartitioned(this.keys2);
			pairs.add(new GlobalPropertiesPair(partitioned_left_hash, partitioned_right_hash));
		}
		else {
			RequestedGlobalProperties partitioned_left = new RequestedGlobalProperties();
			partitioned_left.setCustomPartitioned(this.keys1, this.customPartitioner);

			RequestedGlobalProperties partitioned_right = new RequestedGlobalProperties();
			partitioned_right.setCustomPartitioned(this.keys2, this.customPartitioner);

			return Collections.singletonList(new GlobalPropertiesPair(partitioned_left, partitioned_right));
		}
		
		
		RequestedGlobalProperties partitioned1 = new RequestedGlobalProperties();
		if (customPartitioner == null) {
			partitioned1.setAnyPartitioning(this.keys1);
		} else {
			partitioned1.setCustomPartitioned(this.keys1, this.customPartitioner);
		}
		
		RequestedGlobalProperties partitioned2 = new RequestedGlobalProperties();
		if (customPartitioner == null) {
			partitioned2.setAnyPartitioning(this.keys2);
		} else {
			partitioned2.setCustomPartitioned(this.keys2, this.customPartitioner);
		}
		
		pairs.add(new GlobalPropertiesPair(partitioned1, partitioned2));
	}
	
	if (broadcastSecondAllowed) {
		// replicate second
		RequestedGlobalProperties any1 = new RequestedGlobalProperties();
		RequestedGlobalProperties replicated2 = new RequestedGlobalProperties();
		replicated2.setFullyReplicated();
		pairs.add(new GlobalPropertiesPair(any1, replicated2));
	}
	
	if (broadcastFirstAllowed) {
		// replicate first
		RequestedGlobalProperties replicated1 = new RequestedGlobalProperties();
		replicated1.setFullyReplicated();
		RequestedGlobalProperties any2 = new RequestedGlobalProperties();
		pairs.add(new GlobalPropertiesPair(replicated1, any2));
	}
	return pairs;
}
 
Example 18
Source File: AbstractJoinDescriptor.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
protected List<GlobalPropertiesPair> createPossibleGlobalProperties() {
	ArrayList<GlobalPropertiesPair> pairs = new ArrayList<GlobalPropertiesPair>();
	
	if (repartitionAllowed) {
		// partition both (hash or custom)
		if (this.customPartitioner == null) {

			// we accept compatible partitionings of any type
			RequestedGlobalProperties partitioned_left_any = new RequestedGlobalProperties();
			RequestedGlobalProperties partitioned_right_any = new RequestedGlobalProperties();
			partitioned_left_any.setAnyPartitioning(this.keys1);
			partitioned_right_any.setAnyPartitioning(this.keys2);
			pairs.add(new GlobalPropertiesPair(partitioned_left_any, partitioned_right_any));

			// add strict hash partitioning of both inputs on their full key sets
			RequestedGlobalProperties partitioned_left_hash = new RequestedGlobalProperties();
			RequestedGlobalProperties partitioned_right_hash = new RequestedGlobalProperties();
			partitioned_left_hash.setHashPartitioned(this.keys1);
			partitioned_right_hash.setHashPartitioned(this.keys2);
			pairs.add(new GlobalPropertiesPair(partitioned_left_hash, partitioned_right_hash));
		}
		else {
			RequestedGlobalProperties partitioned_left = new RequestedGlobalProperties();
			partitioned_left.setCustomPartitioned(this.keys1, this.customPartitioner);

			RequestedGlobalProperties partitioned_right = new RequestedGlobalProperties();
			partitioned_right.setCustomPartitioned(this.keys2, this.customPartitioner);

			return Collections.singletonList(new GlobalPropertiesPair(partitioned_left, partitioned_right));
		}
		
		
		RequestedGlobalProperties partitioned1 = new RequestedGlobalProperties();
		if (customPartitioner == null) {
			partitioned1.setAnyPartitioning(this.keys1);
		} else {
			partitioned1.setCustomPartitioned(this.keys1, this.customPartitioner);
		}
		
		RequestedGlobalProperties partitioned2 = new RequestedGlobalProperties();
		if (customPartitioner == null) {
			partitioned2.setAnyPartitioning(this.keys2);
		} else {
			partitioned2.setCustomPartitioned(this.keys2, this.customPartitioner);
		}
		
		pairs.add(new GlobalPropertiesPair(partitioned1, partitioned2));
	}
	
	if (broadcastSecondAllowed) {
		// replicate second
		RequestedGlobalProperties any1 = new RequestedGlobalProperties();
		RequestedGlobalProperties replicated2 = new RequestedGlobalProperties();
		replicated2.setFullyReplicated();
		pairs.add(new GlobalPropertiesPair(any1, replicated2));
	}
	
	if (broadcastFirstAllowed) {
		// replicate first
		RequestedGlobalProperties replicated1 = new RequestedGlobalProperties();
		replicated1.setFullyReplicated();
		RequestedGlobalProperties any2 = new RequestedGlobalProperties();
		pairs.add(new GlobalPropertiesPair(replicated1, any2));
	}
	return pairs;
}