Java Code Examples for org.apache.flink.runtime.io.disk.iomanager.FileIOChannel#Enumerator

The following examples show how to use org.apache.flink.runtime.io.disk.iomanager.FileIOChannel#Enumerator . 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: HashPartition.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public void finalizeBuildPhase(IOManager ioAccess, FileIOChannel.Enumerator probeChannelEnumerator,
		LinkedBlockingQueue<MemorySegment> bufferReturnQueue)
throws IOException
{
	this.finalBufferLimit = this.buildSideWriteBuffer.getCurrentPositionInSegment();
	this.partitionBuffers = this.buildSideWriteBuffer.close();
	
	if (!isInMemory()) {
		// close the channel. note that in the spilled case, the build-side-buffer will have sent off
		// the last segment and it will be returned to the write-behind-buffer queue.
		this.buildSideChannel.close();
		
		// create the channel for the probe side and claim one buffer for it
		this.probeSideChannel = ioAccess.createBlockChannelWriter(probeChannelEnumerator.next(), bufferReturnQueue);
		// creating the ChannelWriterOutputView without memory will cause it to draw one segment from the
		// write behind queue, which is the spare segment we had above.
		this.probeSideBuffer = new ChannelWriterOutputView(this.probeSideChannel, this.memorySegmentSize);
	}
}
 
Example 2
Source File: LongHashPartition.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * After build phase.
 *
 * @return build spill return buffer, if have spilled, it returns the current write buffer,
 * because it was used all the time in build phase, so it can only be returned at this time.
 */
int finalizeBuildPhase(
		IOManager ioAccess,
		FileIOChannel.Enumerator probeChannelEnumerator) throws IOException {
	this.finalBufferLimit = this.buildSideWriteBuffer.getCurrentPositionInSegment();
	this.partitionBuffers = this.buildSideWriteBuffer.close();

	if (!isInMemory()) {
		// close the channel.
		this.buildSideChannel.close();

		this.probeSideBuffer = FileChannelUtil.createOutputView(
				ioAccess,
				probeChannelEnumerator.next(),
				longTable.compressionEnable(),
				longTable.compressionCodecFactory(),
				longTable.compressionBlockSize(),
				segmentSize);
		return 1;
	} else {
		return 0;
	}
}
 
Example 3
Source File: BinaryHashPartition.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * After build phase.
 * @return build spill return buffer, if have spilled, it returns the current write buffer,
 * because it was used all the time in build phase, so it can only be returned at this time.
 */
int finalizeBuildPhase(IOManager ioAccess, FileIOChannel.Enumerator probeChannelEnumerator) throws IOException {
	this.finalBufferLimit = this.buildSideWriteBuffer.getCurrentPositionInSegment();
	this.partitionBuffers = this.buildSideWriteBuffer.close();

	if (!isInMemory()) {
		// close the channel.
		this.buildSideChannel.close();

		this.probeSideBuffer = FileChannelUtil.createOutputView(
				ioAccess,
				probeChannelEnumerator.next(),
				compressionEnable,
				compressionCodecFactory,
				compressionBlockSize,
				memorySegmentSize);
		return 1;
	} else {
		return 0;
	}
}
 
Example 4
Source File: HashPartition.java    From flink with Apache License 2.0 6 votes vote down vote up
public void finalizeBuildPhase(IOManager ioAccess, FileIOChannel.Enumerator probeChannelEnumerator,
		LinkedBlockingQueue<MemorySegment> bufferReturnQueue)
throws IOException
{
	this.finalBufferLimit = this.buildSideWriteBuffer.getCurrentPositionInSegment();
	this.partitionBuffers = this.buildSideWriteBuffer.close();
	
	if (!isInMemory()) {
		// close the channel. note that in the spilled case, the build-side-buffer will have sent off
		// the last segment and it will be returned to the write-behind-buffer queue.
		this.buildSideChannel.close();
		
		// create the channel for the probe side and claim one buffer for it
		this.probeSideChannel = ioAccess.createBlockChannelWriter(probeChannelEnumerator.next(), bufferReturnQueue);
		// creating the ChannelWriterOutputView without memory will cause it to draw one segment from the
		// write behind queue, which is the spare segment we had above.
		this.probeSideBuffer = new ChannelWriterOutputView(this.probeSideChannel, this.memorySegmentSize);
	}
}
 
Example 5
Source File: LongHashPartition.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * After build phase.
 *
 * @return build spill return buffer, if have spilled, it returns the current write buffer,
 * because it was used all the time in build phase, so it can only be returned at this time.
 */
int finalizeBuildPhase(
		IOManager ioAccess,
		FileIOChannel.Enumerator probeChannelEnumerator) throws IOException {
	this.finalBufferLimit = this.buildSideWriteBuffer.getCurrentPositionInSegment();
	this.partitionBuffers = this.buildSideWriteBuffer.close();

	if (!isInMemory()) {
		// close the channel.
		this.buildSideChannel.close();

		this.probeSideBuffer = FileChannelUtil.createOutputView(
				ioAccess,
				probeChannelEnumerator.next(),
				longTable.compressionEnable(),
				longTable.compressionCodecFactory(),
				longTable.compressionBlockSize(),
				segmentSize);
		return 1;
	} else {
		return 0;
	}
}
 
Example 6
Source File: BinaryHashPartition.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * After build phase.
 * @return build spill return buffer, if have spilled, it returns the current write buffer,
 * because it was used all the time in build phase, so it can only be returned at this time.
 */
int finalizeBuildPhase(IOManager ioAccess, FileIOChannel.Enumerator probeChannelEnumerator) throws IOException {
	this.finalBufferLimit = this.buildSideWriteBuffer.getCurrentPositionInSegment();
	this.partitionBuffers = this.buildSideWriteBuffer.close();

	if (!isInMemory()) {
		// close the channel.
		this.buildSideChannel.close();

		this.probeSideBuffer = FileChannelUtil.createOutputView(
				ioAccess,
				probeChannelEnumerator.next(),
				compressionEnable,
				compressionCodecFactory,
				compressionBlockSize,
				memorySegmentSize);
		return 1;
	} else {
		return 0;
	}
}
 
Example 7
Source File: HashPartition.java    From flink with Apache License 2.0 6 votes vote down vote up
public void finalizeBuildPhase(IOManager ioAccess, FileIOChannel.Enumerator probeChannelEnumerator,
		LinkedBlockingQueue<MemorySegment> bufferReturnQueue)
throws IOException
{
	this.finalBufferLimit = this.buildSideWriteBuffer.getCurrentPositionInSegment();
	this.partitionBuffers = this.buildSideWriteBuffer.close();
	
	if (!isInMemory()) {
		// close the channel. note that in the spilled case, the build-side-buffer will have sent off
		// the last segment and it will be returned to the write-behind-buffer queue.
		this.buildSideChannel.close();
		
		// create the channel for the probe side and claim one buffer for it
		this.probeSideChannel = ioAccess.createBlockChannelWriter(probeChannelEnumerator.next(), bufferReturnQueue);
		// creating the ChannelWriterOutputView without memory will cause it to draw one segment from the
		// write behind queue, which is the spare segment we had above.
		this.probeSideBuffer = new ChannelWriterOutputView(this.probeSideChannel, this.memorySegmentSize);
	}
}
 
Example 8
Source File: HashPartition.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public void prepareProbePhase(IOManager ioAccess, FileIOChannel.Enumerator probeChannelEnumerator,
		LinkedBlockingQueue<MemorySegment> bufferReturnQueue) throws IOException {
	if (isInMemory()) {
		return;
	}
	// ATTENTION: The following lines are duplicated code from finalizeBuildPhase
	this.probeSideChannel = ioAccess.createBlockChannelWriter(probeChannelEnumerator.next(), bufferReturnQueue);
	this.probeSideBuffer = new ChannelWriterOutputView(this.probeSideChannel, this.memorySegmentSize);
}
 
Example 9
Source File: HashPartition.java    From flink with Apache License 2.0 5 votes vote down vote up
public void prepareProbePhase(IOManager ioAccess, FileIOChannel.Enumerator probeChannelEnumerator,
		LinkedBlockingQueue<MemorySegment> bufferReturnQueue) throws IOException {
	if (isInMemory()) {
		return;
	}
	// ATTENTION: The following lines are duplicated code from finalizeBuildPhase
	this.probeSideChannel = ioAccess.createBlockChannelWriter(probeChannelEnumerator.next(), bufferReturnQueue);
	this.probeSideBuffer = new ChannelWriterOutputView(this.probeSideChannel, this.memorySegmentSize);
}
 
Example 10
Source File: HashPartition.java    From flink with Apache License 2.0 5 votes vote down vote up
public void prepareProbePhase(IOManager ioAccess, FileIOChannel.Enumerator probeChannelEnumerator,
		LinkedBlockingQueue<MemorySegment> bufferReturnQueue) throws IOException {
	if (isInMemory()) {
		return;
	}
	// ATTENTION: The following lines are duplicated code from finalizeBuildPhase
	this.probeSideChannel = ioAccess.createBlockChannelWriter(probeChannelEnumerator.next(), bufferReturnQueue);
	this.probeSideBuffer = new ChannelWriterOutputView(this.probeSideChannel, this.memorySegmentSize);
}