org.apache.flink.configuration.AlgorithmOptions Java Examples

The following examples show how to use org.apache.flink.configuration.AlgorithmOptions. 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: JobGraphGenerator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public JobGraphGenerator(Configuration config) {
	this.defaultMaxFan = config.getInteger(AlgorithmOptions.SPILLING_MAX_FAN);
	this.defaultSortSpillingThreshold = config.getFloat(AlgorithmOptions.SORT_SPILLING_THRESHOLD);
	this.useLargeRecordHandler = config.getBoolean(
			ConfigConstants.USE_LARGE_RECORD_HANDLER_KEY,
			ConfigConstants.DEFAULT_USE_LARGE_RECORD_HANDLER);
}
 
Example #2
Source File: BinaryExternalSorter.java    From flink with Apache License 2.0 5 votes vote down vote up
public BinaryExternalSorter(
		final Object owner, MemoryManager memoryManager, long reservedMemorySize,
		IOManager ioManager, AbstractRowSerializer<BaseRow> inputSerializer,
		BinaryRowSerializer serializer, NormalizedKeyComputer normalizedKeyComputer,
		RecordComparator comparator, Configuration conf) throws IOException {
	this(owner, memoryManager, reservedMemorySize, ioManager,
			inputSerializer, serializer, normalizedKeyComputer, comparator,
			conf, AlgorithmOptions.SORT_SPILLING_THRESHOLD.defaultValue());
}
 
Example #3
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 5 votes vote down vote up
public JobGraphGenerator(Configuration config) {
	this.defaultMaxFan = config.getInteger(AlgorithmOptions.SPILLING_MAX_FAN);
	this.defaultSortSpillingThreshold = config.getFloat(AlgorithmOptions.SORT_SPILLING_THRESHOLD);
	this.useLargeRecordHandler = config.getBoolean(
			ConfigConstants.USE_LARGE_RECORD_HANDLER_KEY,
			ConfigConstants.DEFAULT_USE_LARGE_RECORD_HANDLER);
}
 
Example #4
Source File: BinaryExternalSorter.java    From flink with Apache License 2.0 5 votes vote down vote up
public BinaryExternalSorter(
		final Object owner, MemoryManager memoryManager, long reservedMemorySize,
		IOManager ioManager, AbstractRowDataSerializer<RowData> inputSerializer,
		BinaryRowDataSerializer serializer, NormalizedKeyComputer normalizedKeyComputer,
		RecordComparator comparator, Configuration conf) {
	this(owner, memoryManager, reservedMemorySize, ioManager,
			inputSerializer, serializer, normalizedKeyComputer, comparator,
			conf, AlgorithmOptions.SORT_SPILLING_THRESHOLD.defaultValue());
}
 
Example #5
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 5 votes vote down vote up
public JobGraphGenerator(Configuration config) {
	this.defaultMaxFan = config.getInteger(AlgorithmOptions.SPILLING_MAX_FAN);
	this.defaultSortSpillingThreshold = config.getFloat(AlgorithmOptions.SORT_SPILLING_THRESHOLD);
	this.useLargeRecordHandler = config.getBoolean(
			ConfigConstants.USE_LARGE_RECORD_HANDLER_KEY,
			ConfigConstants.DEFAULT_USE_LARGE_RECORD_HANDLER);
}
 
Example #6
Source File: AbstractCachedBuildSideJoinDriver.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize() throws Exception {
	TaskConfig config = this.taskContext.getTaskConfig();

	final Counter numRecordsIn = taskContext.getMetricGroup().getIOMetricGroup().getNumRecordsInCounter();
	
	TypeSerializer<IT1> serializer1 = this.taskContext.<IT1>getInputSerializer(0).getSerializer();
	TypeSerializer<IT2> serializer2 = this.taskContext.<IT2>getInputSerializer(1).getSerializer();
	TypeComparator<IT1> comparator1 = this.taskContext.getDriverComparator(0);
	TypeComparator<IT2> comparator2 = this.taskContext.getDriverComparator(1);
	MutableObjectIterator<IT1> input1 = new CountingMutableObjectIterator<>(this.taskContext.<IT1>getInput(0), numRecordsIn);
	MutableObjectIterator<IT2> input2 = new CountingMutableObjectIterator<>(this.taskContext.<IT2>getInput(1), numRecordsIn);

	TypePairComparatorFactory<IT1, IT2> pairComparatorFactory = 
			this.taskContext.getTaskConfig().getPairComparatorFactory(this.taskContext.getUserCodeClassLoader());

	double availableMemory = config.getRelativeMemoryDriver();
	boolean hashJoinUseBitMaps = taskContext.getTaskManagerInfo().getConfiguration()
		.getBoolean(AlgorithmOptions.HASH_JOIN_BLOOM_FILTERS);
	
	ExecutionConfig executionConfig = taskContext.getExecutionConfig();
	objectReuseEnabled = executionConfig.isObjectReuseEnabled();

	if (objectReuseEnabled) {
		if (buildSideIndex == 0 && probeSideIndex == 1) {

			matchIterator = new ReusingBuildFirstReOpenableHashJoinIterator<IT1, IT2, OT>(
					input1, input2,
					serializer1, comparator1,
					serializer2, comparator2,
					pairComparatorFactory.createComparator21(comparator1, comparator2),
					this.taskContext.getMemoryManager(),
					this.taskContext.getIOManager(),
					this.taskContext.getContainingTask(),
					availableMemory,
					false,
					false,
					hashJoinUseBitMaps);


		} else if (buildSideIndex == 1 && probeSideIndex == 0) {

			matchIterator = new ReusingBuildSecondReOpenableHashJoinIterator<IT1, IT2, OT>(
					input1, input2,
					serializer1, comparator1,
					serializer2, comparator2,
					pairComparatorFactory.createComparator12(comparator1, comparator2),
					this.taskContext.getMemoryManager(),
					this.taskContext.getIOManager(),
					this.taskContext.getContainingTask(),
					availableMemory,
					false,
					false,
					hashJoinUseBitMaps);

		} else {
			throw new Exception("Error: Inconsistent setup for repeatable hash join driver.");
		}
	} else {
		if (buildSideIndex == 0 && probeSideIndex == 1) {

			matchIterator = new NonReusingBuildFirstReOpenableHashJoinIterator<IT1, IT2, OT>(
					input1, input2,
					serializer1, comparator1,
					serializer2, comparator2,
					pairComparatorFactory.createComparator21(comparator1, comparator2),
					this.taskContext.getMemoryManager(),
					this.taskContext.getIOManager(),
					this.taskContext.getContainingTask(),
					availableMemory,
					false,
					false,
					hashJoinUseBitMaps);


		} else if (buildSideIndex == 1 && probeSideIndex == 0) {

			matchIterator = new NonReusingBuildSecondReOpenableHashJoinIterator<IT1, IT2, OT>(
					input1, input2,
					serializer1, comparator1,
					serializer2, comparator2,
					pairComparatorFactory.createComparator12(comparator1, comparator2),
					this.taskContext.getMemoryManager(),
					this.taskContext.getIOManager(),
					this.taskContext.getContainingTask(),
					availableMemory,
					false,
					false,
					hashJoinUseBitMaps);

		} else {
			throw new Exception("Error: Inconsistent setup for repeatable hash join driver.");
		}
	}
	
	this.matchIterator.open();
}
 
Example #7
Source File: JobGraphGenerator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new job graph generator that uses the default values for its resource configuration.
 */
public JobGraphGenerator() {
	this.defaultMaxFan = AlgorithmOptions.SPILLING_MAX_FAN.defaultValue();
	this.defaultSortSpillingThreshold = AlgorithmOptions.SORT_SPILLING_THRESHOLD.defaultValue();
	this.useLargeRecordHandler = ConfigConstants.DEFAULT_USE_LARGE_RECORD_HANDLER;
}
 
Example #8
Source File: HashJoinOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void open() throws Exception {
	super.open();

	ClassLoader cl = getContainingTask().getUserCodeClassLoader();

	final AbstractRowSerializer buildSerializer = (AbstractRowSerializer) getOperatorConfig()
		.getTypeSerializerIn1(getUserCodeClassloader());
	final AbstractRowSerializer probeSerializer = (AbstractRowSerializer) getOperatorConfig()
		.getTypeSerializerIn2(getUserCodeClassloader());

	boolean hashJoinUseBitMaps = getContainingTask().getEnvironment().getTaskConfiguration()
			.getBoolean(AlgorithmOptions.HASH_JOIN_BLOOM_FILTERS);

	int parallel = getRuntimeContext().getNumberOfParallelSubtasks();

	this.condition = parameter.condFuncCode.newInstance(cl);
	condition.setRuntimeContext(getRuntimeContext());
	condition.open(new Configuration());

	this.table = new BinaryHashTable(
			getContainingTask().getJobConfiguration(),
			getContainingTask(),
			buildSerializer, probeSerializer,
			parameter.buildProjectionCode.newInstance(cl),
			parameter.probeProjectionCode.newInstance(cl),
			getContainingTask().getEnvironment().getMemoryManager(),
			parameter.reservedMemorySize,
			parameter.maxMemorySize,
			parameter.perRequestMemorySize,
			getContainingTask().getEnvironment().getIOManager(),
			parameter.buildRowSize,
			parameter.buildRowCount / parallel,
			hashJoinUseBitMaps,
			type,
			condition,
			reverseJoinFunction,
			parameter.filterNullKeys,
			parameter.tryDistinctBuildRow);

	this.collector = new StreamRecordCollector<>(output);

	this.buildSideNullRow = new GenericRow(buildSerializer.getArity());
	this.probeSideNullRow = new GenericRow(probeSerializer.getArity());
	this.joinedRow = new JoinedRow();
	this.buildEnd = false;

	getMetricGroup().gauge("memoryUsedSizeInBytes", table::getUsedMemoryInBytes);
	getMetricGroup().gauge("numSpillFiles", table::getNumSpillFiles);
	getMetricGroup().gauge("spillInBytes", table::getSpillInBytes);

	parameter.condFuncCode = null;
	parameter.buildProjectionCode = null;
	parameter.probeProjectionCode = null;
}
 
Example #9
Source File: AbstractCachedBuildSideJoinDriver.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize() throws Exception {
	TaskConfig config = this.taskContext.getTaskConfig();

	final Counter numRecordsIn = taskContext.getMetricGroup().getIOMetricGroup().getNumRecordsInCounter();
	
	TypeSerializer<IT1> serializer1 = this.taskContext.<IT1>getInputSerializer(0).getSerializer();
	TypeSerializer<IT2> serializer2 = this.taskContext.<IT2>getInputSerializer(1).getSerializer();
	TypeComparator<IT1> comparator1 = this.taskContext.getDriverComparator(0);
	TypeComparator<IT2> comparator2 = this.taskContext.getDriverComparator(1);
	MutableObjectIterator<IT1> input1 = new CountingMutableObjectIterator<>(this.taskContext.<IT1>getInput(0), numRecordsIn);
	MutableObjectIterator<IT2> input2 = new CountingMutableObjectIterator<>(this.taskContext.<IT2>getInput(1), numRecordsIn);

	TypePairComparatorFactory<IT1, IT2> pairComparatorFactory = 
			this.taskContext.getTaskConfig().getPairComparatorFactory(this.taskContext.getUserCodeClassLoader());

	double availableMemory = config.getRelativeMemoryDriver();
	boolean hashJoinUseBitMaps = taskContext.getTaskManagerInfo().getConfiguration()
		.getBoolean(AlgorithmOptions.HASH_JOIN_BLOOM_FILTERS);
	
	ExecutionConfig executionConfig = taskContext.getExecutionConfig();
	objectReuseEnabled = executionConfig.isObjectReuseEnabled();

	if (objectReuseEnabled) {
		if (buildSideIndex == 0 && probeSideIndex == 1) {

			matchIterator = new ReusingBuildFirstReOpenableHashJoinIterator<IT1, IT2, OT>(
					input1, input2,
					serializer1, comparator1,
					serializer2, comparator2,
					pairComparatorFactory.createComparator21(comparator1, comparator2),
					this.taskContext.getMemoryManager(),
					this.taskContext.getIOManager(),
					this.taskContext.getContainingTask(),
					availableMemory,
					false,
					false,
					hashJoinUseBitMaps);


		} else if (buildSideIndex == 1 && probeSideIndex == 0) {

			matchIterator = new ReusingBuildSecondReOpenableHashJoinIterator<IT1, IT2, OT>(
					input1, input2,
					serializer1, comparator1,
					serializer2, comparator2,
					pairComparatorFactory.createComparator12(comparator1, comparator2),
					this.taskContext.getMemoryManager(),
					this.taskContext.getIOManager(),
					this.taskContext.getContainingTask(),
					availableMemory,
					false,
					false,
					hashJoinUseBitMaps);

		} else {
			throw new Exception("Error: Inconsistent setup for repeatable hash join driver.");
		}
	} else {
		if (buildSideIndex == 0 && probeSideIndex == 1) {

			matchIterator = new NonReusingBuildFirstReOpenableHashJoinIterator<IT1, IT2, OT>(
					input1, input2,
					serializer1, comparator1,
					serializer2, comparator2,
					pairComparatorFactory.createComparator21(comparator1, comparator2),
					this.taskContext.getMemoryManager(),
					this.taskContext.getIOManager(),
					this.taskContext.getContainingTask(),
					availableMemory,
					false,
					false,
					hashJoinUseBitMaps);


		} else if (buildSideIndex == 1 && probeSideIndex == 0) {

			matchIterator = new NonReusingBuildSecondReOpenableHashJoinIterator<IT1, IT2, OT>(
					input1, input2,
					serializer1, comparator1,
					serializer2, comparator2,
					pairComparatorFactory.createComparator12(comparator1, comparator2),
					this.taskContext.getMemoryManager(),
					this.taskContext.getIOManager(),
					this.taskContext.getContainingTask(),
					availableMemory,
					false,
					false,
					hashJoinUseBitMaps);

		} else {
			throw new Exception("Error: Inconsistent setup for repeatable hash join driver.");
		}
	}
	
	this.matchIterator.open();
}
 
Example #10
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new job graph generator that uses the default values for its resource configuration.
 */
public JobGraphGenerator() {
	this.defaultMaxFan = AlgorithmOptions.SPILLING_MAX_FAN.defaultValue();
	this.defaultSortSpillingThreshold = AlgorithmOptions.SORT_SPILLING_THRESHOLD.defaultValue();
	this.useLargeRecordHandler = ConfigConstants.DEFAULT_USE_LARGE_RECORD_HANDLER;
}
 
Example #11
Source File: HashJoinOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void open() throws Exception {
	super.open();

	ClassLoader cl = getContainingTask().getUserCodeClassLoader();

	final AbstractRowDataSerializer buildSerializer = (AbstractRowDataSerializer) getOperatorConfig()
		.getTypeSerializerIn1(getUserCodeClassloader());
	final AbstractRowDataSerializer probeSerializer = (AbstractRowDataSerializer) getOperatorConfig()
		.getTypeSerializerIn2(getUserCodeClassloader());

	boolean hashJoinUseBitMaps = getContainingTask().getEnvironment().getTaskConfiguration()
			.getBoolean(AlgorithmOptions.HASH_JOIN_BLOOM_FILTERS);

	int parallel = getRuntimeContext().getNumberOfParallelSubtasks();

	this.condition = parameter.condFuncCode.newInstance(cl);
	condition.setRuntimeContext(getRuntimeContext());
	condition.open(new Configuration());

	this.table = new BinaryHashTable(
			getContainingTask().getJobConfiguration(),
			getContainingTask(),
			buildSerializer, probeSerializer,
			parameter.buildProjectionCode.newInstance(cl),
			parameter.probeProjectionCode.newInstance(cl),
			getContainingTask().getEnvironment().getMemoryManager(),
			computeMemorySize(),
			getContainingTask().getEnvironment().getIOManager(),
			parameter.buildRowSize,
			parameter.buildRowCount / parallel,
			hashJoinUseBitMaps,
			type,
			condition,
			reverseJoinFunction,
			parameter.filterNullKeys,
			parameter.tryDistinctBuildRow);

	this.collector = new StreamRecordCollector<>(output);

	this.buildSideNullRow = new GenericRowData(buildSerializer.getArity());
	this.probeSideNullRow = new GenericRowData(probeSerializer.getArity());
	this.joinedRow = new JoinedRowData();
	this.buildEnd = false;

	getMetricGroup().gauge("memoryUsedSizeInBytes", table::getUsedMemoryInBytes);
	getMetricGroup().gauge("numSpillFiles", table::getNumSpillFiles);
	getMetricGroup().gauge("spillInBytes", table::getSpillInBytes);

	parameter.condFuncCode = null;
	parameter.buildProjectionCode = null;
	parameter.probeProjectionCode = null;
}
 
Example #12
Source File: AbstractCachedBuildSideJoinDriver.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize() throws Exception {
	TaskConfig config = this.taskContext.getTaskConfig();

	final Counter numRecordsIn = taskContext.getMetricGroup().getIOMetricGroup().getNumRecordsInCounter();
	
	TypeSerializer<IT1> serializer1 = this.taskContext.<IT1>getInputSerializer(0).getSerializer();
	TypeSerializer<IT2> serializer2 = this.taskContext.<IT2>getInputSerializer(1).getSerializer();
	TypeComparator<IT1> comparator1 = this.taskContext.getDriverComparator(0);
	TypeComparator<IT2> comparator2 = this.taskContext.getDriverComparator(1);
	MutableObjectIterator<IT1> input1 = new CountingMutableObjectIterator<>(this.taskContext.<IT1>getInput(0), numRecordsIn);
	MutableObjectIterator<IT2> input2 = new CountingMutableObjectIterator<>(this.taskContext.<IT2>getInput(1), numRecordsIn);

	TypePairComparatorFactory<IT1, IT2> pairComparatorFactory = 
			this.taskContext.getTaskConfig().getPairComparatorFactory(this.taskContext.getUserCodeClassLoader());

	double availableMemory = config.getRelativeMemoryDriver();
	boolean hashJoinUseBitMaps = taskContext.getTaskManagerInfo().getConfiguration()
		.getBoolean(AlgorithmOptions.HASH_JOIN_BLOOM_FILTERS);
	
	ExecutionConfig executionConfig = taskContext.getExecutionConfig();
	objectReuseEnabled = executionConfig.isObjectReuseEnabled();

	if (objectReuseEnabled) {
		if (buildSideIndex == 0 && probeSideIndex == 1) {

			matchIterator = new ReusingBuildFirstReOpenableHashJoinIterator<IT1, IT2, OT>(
					input1, input2,
					serializer1, comparator1,
					serializer2, comparator2,
					pairComparatorFactory.createComparator21(comparator1, comparator2),
					this.taskContext.getMemoryManager(),
					this.taskContext.getIOManager(),
					this.taskContext.getContainingTask(),
					availableMemory,
					false,
					false,
					hashJoinUseBitMaps);


		} else if (buildSideIndex == 1 && probeSideIndex == 0) {

			matchIterator = new ReusingBuildSecondReOpenableHashJoinIterator<IT1, IT2, OT>(
					input1, input2,
					serializer1, comparator1,
					serializer2, comparator2,
					pairComparatorFactory.createComparator12(comparator1, comparator2),
					this.taskContext.getMemoryManager(),
					this.taskContext.getIOManager(),
					this.taskContext.getContainingTask(),
					availableMemory,
					false,
					false,
					hashJoinUseBitMaps);

		} else {
			throw new Exception("Error: Inconsistent setup for repeatable hash join driver.");
		}
	} else {
		if (buildSideIndex == 0 && probeSideIndex == 1) {

			matchIterator = new NonReusingBuildFirstReOpenableHashJoinIterator<IT1, IT2, OT>(
					input1, input2,
					serializer1, comparator1,
					serializer2, comparator2,
					pairComparatorFactory.createComparator21(comparator1, comparator2),
					this.taskContext.getMemoryManager(),
					this.taskContext.getIOManager(),
					this.taskContext.getContainingTask(),
					availableMemory,
					false,
					false,
					hashJoinUseBitMaps);


		} else if (buildSideIndex == 1 && probeSideIndex == 0) {

			matchIterator = new NonReusingBuildSecondReOpenableHashJoinIterator<IT1, IT2, OT>(
					input1, input2,
					serializer1, comparator1,
					serializer2, comparator2,
					pairComparatorFactory.createComparator12(comparator1, comparator2),
					this.taskContext.getMemoryManager(),
					this.taskContext.getIOManager(),
					this.taskContext.getContainingTask(),
					availableMemory,
					false,
					false,
					hashJoinUseBitMaps);

		} else {
			throw new Exception("Error: Inconsistent setup for repeatable hash join driver.");
		}
	}
	
	this.matchIterator.open();
}
 
Example #13
Source File: JobGraphGenerator.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new job graph generator that uses the default values for its resource configuration.
 */
public JobGraphGenerator() {
	this.defaultMaxFan = AlgorithmOptions.SPILLING_MAX_FAN.defaultValue();
	this.defaultSortSpillingThreshold = AlgorithmOptions.SORT_SPILLING_THRESHOLD.defaultValue();
	this.useLargeRecordHandler = ConfigConstants.DEFAULT_USE_LARGE_RECORD_HANDLER;
}