-
Notifications
You must be signed in to change notification settings - Fork 966
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flink] Avoid deprecated SetupableStreamOperator
- Loading branch information
1 parent
ee466bc
commit 0333afe
Showing
22 changed files
with
428 additions
and
176 deletions.
There are no files selected for viewing
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
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
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
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
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
94 changes: 94 additions & 0 deletions
94
...c/main/java/org/apache/paimon/flink/sink/AutoTagForSavepointCommitterOperatorFactory.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,94 @@ | ||
/* | ||
* 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://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.paimon.flink.sink; | ||
|
||
import org.apache.paimon.operation.TagDeletion; | ||
import org.apache.paimon.table.sink.TagCallback; | ||
import org.apache.paimon.utils.SerializableSupplier; | ||
import org.apache.paimon.utils.SnapshotManager; | ||
import org.apache.paimon.utils.TagManager; | ||
|
||
import org.apache.flink.streaming.api.operators.AbstractStreamOperatorFactory; | ||
import org.apache.flink.streaming.api.operators.OneInputStreamOperatorFactory; | ||
import org.apache.flink.streaming.api.operators.StreamOperator; | ||
import org.apache.flink.streaming.api.operators.StreamOperatorParameters; | ||
|
||
import java.time.Duration; | ||
import java.util.List; | ||
import java.util.NavigableSet; | ||
import java.util.TreeSet; | ||
|
||
/** | ||
* {@link org.apache.flink.streaming.api.operators.StreamOperatorFactory} for {@link | ||
* AutoTagForSavepointCommitterOperator}. | ||
*/ | ||
public class AutoTagForSavepointCommitterOperatorFactory<CommitT, GlobalCommitT> | ||
extends AbstractStreamOperatorFactory<CommitT> | ||
implements OneInputStreamOperatorFactory<CommitT, CommitT> { | ||
|
||
private final CommitterOperatorFactory<CommitT, GlobalCommitT> commitOperatorFactory; | ||
|
||
private final SerializableSupplier<SnapshotManager> snapshotManagerFactory; | ||
|
||
private final SerializableSupplier<TagManager> tagManagerFactory; | ||
|
||
private final SerializableSupplier<TagDeletion> tagDeletionFactory; | ||
|
||
private final SerializableSupplier<List<TagCallback>> callbacksSupplier; | ||
|
||
private final NavigableSet<Long> identifiersForTags; | ||
|
||
private final Duration tagTimeRetained; | ||
|
||
public AutoTagForSavepointCommitterOperatorFactory( | ||
CommitterOperatorFactory<CommitT, GlobalCommitT> commitOperatorFactory, | ||
SerializableSupplier<SnapshotManager> snapshotManagerFactory, | ||
SerializableSupplier<TagManager> tagManagerFactory, | ||
SerializableSupplier<TagDeletion> tagDeletionFactory, | ||
SerializableSupplier<List<TagCallback>> callbacksSupplier, | ||
Duration tagTimeRetained) { | ||
this.commitOperatorFactory = commitOperatorFactory; | ||
this.tagManagerFactory = tagManagerFactory; | ||
this.snapshotManagerFactory = snapshotManagerFactory; | ||
this.tagDeletionFactory = tagDeletionFactory; | ||
this.callbacksSupplier = callbacksSupplier; | ||
this.identifiersForTags = new TreeSet<>(); | ||
this.tagTimeRetained = tagTimeRetained; | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
public <T extends StreamOperator<CommitT>> T createStreamOperator( | ||
StreamOperatorParameters<CommitT> parameters) { | ||
return (T) | ||
new AutoTagForSavepointCommitterOperator<>( | ||
commitOperatorFactory.createStreamOperator(parameters), | ||
snapshotManagerFactory, | ||
tagManagerFactory, | ||
tagDeletionFactory, | ||
callbacksSupplier, | ||
tagTimeRetained); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("rawtypes") | ||
public Class<? extends StreamOperator> getStreamOperatorClass(ClassLoader classLoader) { | ||
return AutoTagForSavepointCommitterOperator.class; | ||
} | ||
} |
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
60 changes: 60 additions & 0 deletions
60
...mon/src/main/java/org/apache/paimon/flink/sink/BatchWriteGeneratorTagOperatorFactory.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,60 @@ | ||
/* | ||
* 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://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.paimon.flink.sink; | ||
|
||
import org.apache.paimon.table.FileStoreTable; | ||
|
||
import org.apache.flink.streaming.api.operators.AbstractStreamOperatorFactory; | ||
import org.apache.flink.streaming.api.operators.OneInputStreamOperatorFactory; | ||
import org.apache.flink.streaming.api.operators.StreamOperator; | ||
import org.apache.flink.streaming.api.operators.StreamOperatorParameters; | ||
|
||
/** | ||
* {@link org.apache.flink.streaming.api.operators.StreamOperatorFactory} for {@link | ||
* BatchWriteGeneratorTagOperator}. | ||
*/ | ||
public class BatchWriteGeneratorTagOperatorFactory<CommitT, GlobalCommitT> | ||
extends AbstractStreamOperatorFactory<CommitT> | ||
implements OneInputStreamOperatorFactory<CommitT, CommitT> { | ||
private final CommitterOperatorFactory<CommitT, GlobalCommitT> commitOperatorFactory; | ||
|
||
protected final FileStoreTable table; | ||
|
||
public BatchWriteGeneratorTagOperatorFactory( | ||
CommitterOperatorFactory<CommitT, GlobalCommitT> commitOperatorFactory, | ||
FileStoreTable table) { | ||
this.table = table; | ||
this.commitOperatorFactory = commitOperatorFactory; | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
public <T extends StreamOperator<CommitT>> T createStreamOperator( | ||
StreamOperatorParameters<CommitT> parameters) { | ||
return (T) | ||
new BatchWriteGeneratorTagOperator<>( | ||
commitOperatorFactory.createStreamOperator(parameters), table); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("rawtypes") | ||
public Class<? extends StreamOperator> getStreamOperatorClass(ClassLoader classLoader) { | ||
return BatchWriteGeneratorTagOperator.class; | ||
} | ||
} |
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.