@Internal public class CompactOperator<T> extends org.apache.flink.streaming.api.operators.AbstractStreamOperator<PartitionCommitInfo> implements org.apache.flink.streaming.api.operators.OneInputStreamOperator<CompactMessages.CoordinatorOutput,PartitionCommitInfo>, org.apache.flink.streaming.api.operators.BoundedOneInput
Use BulkFormat to read and use BucketWriter to write.
STATE: This operator stores expired files in state, after the checkpoint completes successfully, We can ensure that these files will not be used again and they can be deleted from the file system.
| Modifier and Type | Field and Description |
|---|---|
static String |
COMPACTED_PREFIX |
static String |
UNCOMPACTED_PREFIX |
| Constructor and Description |
|---|
CompactOperator(org.apache.flink.util.function.SupplierWithException<org.apache.flink.core.fs.FileSystem,IOException> fsFactory,
CompactReader.Factory<T> readerFactory,
CompactWriter.Factory<T> writerFactory) |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.flink.core.fs.Path |
convertFromUncompacted(org.apache.flink.core.fs.Path path) |
static String |
convertToUncompacted(String path) |
void |
endInput() |
void |
initializeState(org.apache.flink.runtime.state.StateInitializationContext context) |
void |
notifyCheckpointComplete(long checkpointId) |
void |
processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<CompactMessages.CoordinatorOutput> element) |
void |
snapshotState(org.apache.flink.runtime.state.StateSnapshotContext context) |
close, finish, getChainingStrategy, getContainingTask, getCurrentKey, getExecutionConfig, getInternalTimerService, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getStateKeySelector1, getStateKeySelector2, getTimeServiceManager, getUserCodeClassloader, hasKeyContext1, hasKeyContext2, initializeState, isUsingCustomRawKeyedState, notifyCheckpointAborted, open, prepareSnapshotPreBarrier, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processRecordAttributes, processRecordAttributes1, processRecordAttributes2, processWatermark, processWatermark1, processWatermark2, processWatermarkStatus, processWatermarkStatus1, processWatermarkStatus2, reportOrForwardLatencyMarker, setChainingStrategy, setCurrentKey, setKeyContextElement1, setKeyContextElement2, setMailboxExecutor, setProcessingTimeService, setup, snapshotState, useSplittableTimersclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetKeyContextElementclose, finish, getMetricGroup, getOperatorAttributes, getOperatorID, initializeState, open, prepareSnapshotPreBarrier, setKeyContextElement1, setKeyContextElement2, snapshotStatenotifyCheckpointAbortedgetCurrentKey, setCurrentKeypublic static final String UNCOMPACTED_PREFIX
public static final String COMPACTED_PREFIX
public CompactOperator(org.apache.flink.util.function.SupplierWithException<org.apache.flink.core.fs.FileSystem,IOException> fsFactory, CompactReader.Factory<T> readerFactory, CompactWriter.Factory<T> writerFactory)
public void initializeState(org.apache.flink.runtime.state.StateInitializationContext context)
throws Exception
initializeState in interface org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperatorinitializeState in class org.apache.flink.streaming.api.operators.AbstractStreamOperator<PartitionCommitInfo>Exceptionpublic void processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<CompactMessages.CoordinatorOutput> element) throws Exception
processElement in interface org.apache.flink.streaming.api.operators.Input<CompactMessages.CoordinatorOutput>Exceptionpublic void snapshotState(org.apache.flink.runtime.state.StateSnapshotContext context)
throws Exception
snapshotState in interface org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperatorsnapshotState in class org.apache.flink.streaming.api.operators.AbstractStreamOperator<PartitionCommitInfo>Exceptionpublic void notifyCheckpointComplete(long checkpointId)
throws Exception
notifyCheckpointComplete in interface org.apache.flink.api.common.state.CheckpointListenernotifyCheckpointComplete in class org.apache.flink.streaming.api.operators.AbstractStreamOperator<PartitionCommitInfo>Exceptionpublic void endInput()
throws Exception
endInput in interface org.apache.flink.streaming.api.operators.BoundedOneInputExceptionpublic static org.apache.flink.core.fs.Path convertFromUncompacted(org.apache.flink.core.fs.Path path)
Copyright © 2014–2025 The Apache Software Foundation. All rights reserved.