Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make project compatible with Flink 1.12.2 #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.state.AggregatingStateDescriptor;
import org.apache.flink.api.common.state.FoldingStateDescriptor;
import org.apache.flink.api.common.state.ListStateDescriptor;
import org.apache.flink.api.common.state.MapStateDescriptor;
import org.apache.flink.api.common.state.ReducingStateDescriptor;
Expand Down Expand Up @@ -75,8 +74,7 @@ public class SpillableKeyedStateBackend<K> extends HeapKeyedStateBackend<K> {
Tuple2.of(ListStateDescriptor.class, (StateFactory) SpillableListState::create),
Tuple2.of(MapStateDescriptor.class, (StateFactory) SpillableMapState::create),
Tuple2.of(AggregatingStateDescriptor.class, (StateFactory) SpillableAggregatingState::create),
Tuple2.of(ReducingStateDescriptor.class, (StateFactory) SpillableReducingState::create),
Tuple2.of(FoldingStateDescriptor.class, (StateFactory) SpillableFoldingState::create)
Tuple2.of(ReducingStateDescriptor.class, (StateFactory) SpillableReducingState::create)
).collect(Collectors.toMap(t -> t.f0, t -> t.f1));

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
import org.apache.flink.runtime.state.internal.InternalMapState;
import org.apache.flink.util.Preconditions;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.*;

/**
* A {@link MapState} backed by spillable backend.
Expand Down Expand Up @@ -189,7 +186,7 @@ public Iterable<Map.Entry<UK, UV>> entries() {
Map<UK, UV> userMap = stateMap.get(key, namespace);

if (userMap == null) {
return null;
return Collections.emptySet();
}

return stateMap instanceof CopyOnWriteStateMap ? userMap.entrySet() :
Expand All @@ -212,7 +209,7 @@ public Iterable<UK> keys() {
Map<UK, UV> userMap = stateMap.get(key, namespace);

if (userMap == null) {
return null;
return Collections.emptySet();
}

return stateMap instanceof CopyOnWriteStateMap ? userMap.keySet() :
Expand Down Expand Up @@ -251,7 +248,7 @@ public Iterable<UV> values() {
Map<UK, UV> userMap = stateMap.get(key, namespace);

if (userMap == null) {
return null;
return Collections.emptySet();
}

return stateMap instanceof CopyOnWriteStateMap ? userMap.values() :
Expand Down Expand Up @@ -290,7 +287,7 @@ public Iterator<Map.Entry<UK, UV>> iterator() {
Map<UK, UV> userMap = stateMap.get(key, namespace);

if (userMap == null) {
return null;
return Collections.emptyIterator();
}

return stateMap instanceof CopyOnWriteStateMap ? userMap.entrySet().iterator() :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.apache.flink.runtime.query.TaskKvStateRegistry;
import org.apache.flink.runtime.state.AbstractKeyedStateBackend;
import org.apache.flink.runtime.state.AbstractStateBackend;
import org.apache.flink.runtime.state.CheckpointStorage;
import org.apache.flink.runtime.state.CheckpointStorageAccess;
import org.apache.flink.runtime.state.CompletedCheckpointStorageLocation;
import org.apache.flink.runtime.state.ConfigurableStateBackend;
import org.apache.flink.runtime.state.DefaultOperatorStateBackendBuilder;
Expand Down Expand Up @@ -143,7 +143,7 @@ public <K> AbstractKeyedStateBackend<K> createKeyedStateBackend(
return new SpillableKeyedStateBackendBuilder<>(
kvStateRegistry,
keySerializer,
env.getUserClassLoader(),
env.getUserCodeClassLoader().asClassLoader(),
numberOfKeyGroups,
keyGroupRange,
env.getExecutionConfig(),
Expand All @@ -166,7 +166,7 @@ public OperatorStateBackend createOperatorStateBackend(
// TODO whether to support sync snapshot
final boolean asyncSnapshots = true;
return new DefaultOperatorStateBackendBuilder(
env.getUserClassLoader(),
env.getUserCodeClassLoader().asClassLoader(),
env.getExecutionConfig(),
asyncSnapshots,
stateHandles,
Expand All @@ -179,7 +179,7 @@ public CompletedCheckpointStorageLocation resolveCheckpoint(String externalPoint
}

@Override
public CheckpointStorage createCheckpointStorage(JobID jobId) throws IOException {
public CheckpointStorageAccess createCheckpointStorage(JobID jobId) throws IOException {
return checkpointStreamBackend.createCheckpointStorage(jobId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class SpillableTtlUtils {
new TtlMapStatePerElementTestContext(),
new TtlMapStatePerNullElementTestContext(),
new TtlAggregatingStateTestContext(),
new TtlReducingStateTestContext(),
new TtlFoldingStateTestContext());
new TtlReducingStateTestContext());
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ under the License.
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<flink.version>1.11-SNAPSHOT</flink.version>
<flink.version>1.12.2</flink.version>
<scala.binary.version>2.11</scala.binary.version>
</properties>

Expand Down