Java Code Examples for org.apache.flink.optimizer.dataproperties.PartitioningProperty#RANDOM_PARTITIONED

The following examples show how to use org.apache.flink.optimizer.dataproperties.PartitioningProperty#RANDOM_PARTITIONED . 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: GroupCombineProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED) {
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 2
Source File: CoGroupDescriptor.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties in1, GlobalProperties in2) {
	GlobalProperties gp = GlobalProperties.combine(in1, in2);
	if (gp.getUniqueFieldCombination() != null && gp.getUniqueFieldCombination().size() > 0 &&
				gp.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gp.setAnyPartitioning(gp.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gp.clearUniqueFieldCombinations();
	return gp;
}
 
Example 3
Source File: FlatMapDescriptor.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 4
Source File: PartialGroupProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 5
Source File: GroupReduceProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 6
Source File: FlatMapDescriptor.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 7
Source File: AllGroupWithPartialPreGroupProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 8
Source File: AllGroupCombineProperties.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 9
Source File: CoGroupDescriptor.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties in1, GlobalProperties in2) {
	GlobalProperties gp = GlobalProperties.combine(in1, in2);
	if (gp.getUniqueFieldCombination() != null && gp.getUniqueFieldCombination().size() > 0 &&
				gp.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gp.setAnyPartitioning(gp.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gp.clearUniqueFieldCombinations();
	return gp;
}
 
Example 10
Source File: GroupReduceWithCombineProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 11
Source File: CoGroupRawDescriptor.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties in1, GlobalProperties in2) {
	GlobalProperties gp = GlobalProperties.combine(in1, in2);
	if (gp.getUniqueFieldCombination() != null && gp.getUniqueFieldCombination().size() > 0
			&& gp.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED) {
		gp.setAnyPartitioning(gp.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gp.clearUniqueFieldCombinations();
	return gp;
}
 
Example 12
Source File: CoGroupDescriptor.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties in1, GlobalProperties in2) {
	GlobalProperties gp = GlobalProperties.combine(in1, in2);
	if (gp.getUniqueFieldCombination() != null && gp.getUniqueFieldCombination().size() > 0 &&
				gp.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gp.setAnyPartitioning(gp.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gp.clearUniqueFieldCombinations();
	return gp;
}
 
Example 13
Source File: AllGroupReduceProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 14
Source File: AllGroupReduceProperties.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 15
Source File: AllGroupWithPartialPreGroupProperties.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 16
Source File: AllGroupCombineProperties.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 17
Source File: CartesianProductDescriptor.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties in1, GlobalProperties in2) {
	GlobalProperties gp = GlobalProperties.combine(in1, in2);
	if (gp.getUniqueFieldCombination() != null && gp.getUniqueFieldCombination().size() > 0 &&
				gp.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gp.setAnyPartitioning(gp.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gp.clearUniqueFieldCombinations();
	return gp;
}
 
Example 18
Source File: GroupReduceProperties.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties gProps) {
	if (gProps.getUniqueFieldCombination() != null && gProps.getUniqueFieldCombination().size() > 0 &&
			gProps.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gProps.setAnyPartitioning(gProps.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gProps.clearUniqueFieldCombinations();
	return gProps;
}
 
Example 19
Source File: AbstractJoinDescriptor.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public GlobalProperties computeGlobalProperties(GlobalProperties in1, GlobalProperties in2) {
	GlobalProperties gp = GlobalProperties.combine(in1, in2);
	if (gp.getUniqueFieldCombination() != null && gp.getUniqueFieldCombination().size() > 0 &&
				gp.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED)
	{
		gp.setAnyPartitioning(gp.getUniqueFieldCombination().iterator().next().toFieldList());
	}
	gp.clearUniqueFieldCombinations();
	return gp;
}
 
Example 20
Source File: PartitioningReusageTest.java    From flink with Apache License 2.0 4 votes vote down vote up
private void checkValidJoinInputProperties(DualInputPlanNode join) {

		GlobalProperties inProps1 = join.getInput1().getGlobalProperties();
		GlobalProperties inProps2 = join.getInput2().getGlobalProperties();

		if(inProps1.getPartitioning() == PartitioningProperty.HASH_PARTITIONED &&
				inProps2.getPartitioning() == PartitioningProperty.HASH_PARTITIONED) {

			// check that both inputs are hash partitioned on the same fields
			FieldList pFields1 = inProps1.getPartitioningFields();
			FieldList pFields2 = inProps2.getPartitioningFields();

			assertTrue("Inputs are not the same number of fields. Input 1: "+pFields1+", Input 2: "+pFields2,
					pFields1.size() == pFields2.size());

			FieldList reqPFields1 = join.getKeysForInput1();
			FieldList reqPFields2 = join.getKeysForInput2();

			for(int i=0; i<pFields1.size(); i++) {

				// get fields
				int f1 = pFields1.get(i);
				int f2 = pFields2.get(i);

				// check that field positions in original key field list are identical
				int pos1 = getPosInFieldList(f1, reqPFields1);
				int pos2 = getPosInFieldList(f2, reqPFields2);

				if(pos1 < 0) {
					fail("Input 1 is partitioned on field "+f1+" which is not contained in the key set "+reqPFields1);
				}
				if(pos2 < 0) {
					fail("Input 2 is partitioned on field "+f2+" which is not contained in the key set "+reqPFields2);
				}
				if(pos1 != pos2) {
					fail("Inputs are not partitioned on the same key fields");
				}
			}

		}
		else if(inProps1.getPartitioning() == PartitioningProperty.FULL_REPLICATION &&
				inProps2.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED) {
			// we are good. No need to check for fields
		}
		else if(inProps1.getPartitioning() == PartitioningProperty.RANDOM_PARTITIONED &&
				inProps2.getPartitioning() == PartitioningProperty.FULL_REPLICATION) {
			// we are good. No need to check for fields
		}
		else {
			throw new UnsupportedOperationException("This method has only been implemented to check for hash partitioned coGroupinputs");
		}

	}