forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-11863][table-runtime-blink] Introduce channel to read and writ…
…e compressed data (apache#7944)
- Loading branch information
Showing
13 changed files
with
1,352 additions
and
61 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
.../main/java/org/apache/flink/runtime/io/disk/iomanager/AbstractChannelReaderInputView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http:https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.runtime.io.disk.iomanager; | ||
|
||
import org.apache.flink.core.memory.MemorySegment; | ||
import org.apache.flink.runtime.memory.AbstractPagedInputView; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
/** | ||
* A {@link org.apache.flink.core.memory.DataInputView} that is backed by a | ||
* {@link FileIOChannel}, making it effectively a data input stream. The view reads it data | ||
* in blocks from the underlying channel. The view can only read data that | ||
* has been written by a {@link ChannelWriterOutputView}, due to block formatting. | ||
*/ | ||
public abstract class AbstractChannelReaderInputView extends AbstractPagedInputView { | ||
|
||
public AbstractChannelReaderInputView(int headerLength) { | ||
super(headerLength); | ||
} | ||
|
||
/** | ||
* Closes this InputView, closing the underlying reader and returning all memory segments. | ||
* | ||
* @return A list containing all memory segments originally supplied to this view. | ||
* @throws IOException Thrown, if the underlying reader could not be properly closed. | ||
*/ | ||
public abstract List<MemorySegment> close() throws IOException; | ||
|
||
/** | ||
* Get the underlying channel. | ||
*/ | ||
public abstract FileIOChannel getChannel(); | ||
|
||
} |
63 changes: 63 additions & 0 deletions
63
...main/java/org/apache/flink/runtime/io/disk/iomanager/AbstractChannelWriterOutputView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http:https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.runtime.io.disk.iomanager; | ||
|
||
import org.apache.flink.runtime.memory.AbstractPagedOutputView; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* A {@link org.apache.flink.core.memory.DataOutputView} that is backed by a {@link FileIOChannel}, | ||
* making it effectively a data output stream. The view writes it data in blocks to the underlying | ||
* channel. | ||
*/ | ||
public abstract class AbstractChannelWriterOutputView extends AbstractPagedOutputView { | ||
|
||
public AbstractChannelWriterOutputView(int segmentSize, int headerLength) { | ||
super(segmentSize, headerLength); | ||
} | ||
|
||
/** | ||
* Get the underlying channel. | ||
*/ | ||
public abstract FileIOChannel getChannel(); | ||
|
||
/** | ||
* Closes this OutputView, closing the underlying writer | ||
* | ||
* @return the number of bytes in last memory segment. | ||
*/ | ||
public abstract int close() throws IOException; | ||
|
||
/** | ||
* Gets the number of blocks used by this view. | ||
*/ | ||
public abstract int getBlockCount(); | ||
|
||
/** | ||
* Get output bytes. | ||
*/ | ||
public abstract long getNumBytes() throws IOException; | ||
|
||
/** | ||
* Get output compressed bytes, return num bytes if there is no compression. | ||
*/ | ||
public abstract long getNumCompressedBytes() throws IOException; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.