Search in sources :

Example 6 with FlinkVersion

use of org.apache.flink.FlinkVersion in project flink by apache.

the class RowSerializerUpgradeTest method testSpecifications.

@Parameterized.Parameters(name = "Test Specification = {0}")
public static Collection<TestSpecification<?, ?>> testSpecifications() throws Exception {
    ArrayList<TestSpecification<?, ?>> testSpecifications = new ArrayList<>();
    // for RowSerializer we also test against 1.10 and newer because we have snapshots
    // for this which go beyond what we have for the usual subclasses of
    // TypeSerializerUpgradeTestBase
    List<FlinkVersion> testVersions = new ArrayList<>();
    testVersions.add(FlinkVersion.v1_10);
    testVersions.addAll(MIGRATION_VERSIONS);
    for (FlinkVersion flinkVersion : testVersions) {
        testSpecifications.add(new TestSpecification<>("row-serializer", flinkVersion, RowSerializerSetup.class, RowSerializerVerifier.class));
    }
    return testSpecifications;
}
Also used : ArrayList(java.util.ArrayList) FlinkVersion(org.apache.flink.FlinkVersion)

Example 7 with FlinkVersion

use of org.apache.flink.FlinkVersion in project flink by apache.

the class KafkaSerializerUpgradeTest method testSpecifications.

@Parameterized.Parameters(name = "Test Specification = {0}")
public static Collection<TestSpecification<?, ?>> testSpecifications() throws Exception {
    ArrayList<TestSpecification<?, ?>> testSpecifications = new ArrayList<>();
    for (FlinkVersion flinkVersion : MIGRATION_VERSIONS) {
        testSpecifications.add(new TestSpecification<>("transaction-state-serializer", flinkVersion, TransactionStateSerializerSetup.class, TransactionStateSerializerVerifier.class));
        testSpecifications.add(new TestSpecification<>("context-state-serializer", flinkVersion, ContextStateSerializerSetup.class, ContextStateSerializerVerifier.class));
    }
    return testSpecifications;
}
Also used : ArrayList(java.util.ArrayList) FlinkVersion(org.apache.flink.FlinkVersion)

Example 8 with FlinkVersion

use of org.apache.flink.FlinkVersion in project flink by apache.

the class WindowSerializerUpgradeTest method testSpecifications.

@Parameterized.Parameters(name = "Test Specification = {0}")
public static Collection<TestSpecification<?, ?>> testSpecifications() throws Exception {
    ArrayList<TestSpecification<?, ?>> testSpecifications = new ArrayList<>();
    for (FlinkVersion flinkVersion : MIGRATION_VERSIONS) {
        testSpecifications.add(new TestSpecification<>("time-window-serializer", flinkVersion, TimeWindowSerializerSetup.class, TimeWindowSerializerVerifier.class));
        testSpecifications.add(new TestSpecification<>("global-window-serializer", flinkVersion, GlobalWindowSerializerSetup.class, GlobalWindowSerializerVerifier.class));
    }
    return testSpecifications;
}
Also used : ArrayList(java.util.ArrayList) FlinkVersion(org.apache.flink.FlinkVersion)

Example 9 with FlinkVersion

use of org.apache.flink.FlinkVersion in project flink by apache.

the class UnionSerializerUpgradeTest method testSpecifications.

@Parameterized.Parameters(name = "Test Specification = {0}")
public static Collection<TestSpecification<?, ?>> testSpecifications() throws Exception {
    ArrayList<TestSpecification<?, ?>> testSpecifications = new ArrayList<>();
    for (FlinkVersion flinkVersion : MIGRATION_VERSIONS) {
        testSpecifications.add(new TestSpecification<>("union-serializer-one", flinkVersion, UnionSerializerOneSetup.class, UnionSerializerOneVerifier.class));
        testSpecifications.add(new TestSpecification<>("union-serializer-two", flinkVersion, UnionSerializerTwoSetup.class, UnionSerializerTwoVerifier.class));
    }
    return testSpecifications;
}
Also used : ArrayList(java.util.ArrayList) FlinkVersion(org.apache.flink.FlinkVersion)

Example 10 with FlinkVersion

use of org.apache.flink.FlinkVersion in project flink by apache.

the class JsonPlanGraph method convertToExecNodeGraph.

ExecNodeGraph convertToExecNodeGraph() {
    Map<Integer, ExecNode<?>> idToExecNodes = new HashMap<>();
    for (ExecNode<?> execNode : nodes) {
        int id = execNode.getId();
        if (idToExecNodes.containsKey(id)) {
            throw new TableException(String.format("The id: %s is not unique for ExecNode: %s.\nplease check it.", id, execNode.getDescription()));
        }
        idToExecNodes.put(id, execNode);
    }
    Map<Integer, List<ExecEdge>> idToInputEdges = new HashMap<>();
    Map<Integer, List<ExecEdge>> idToOutputEdges = new HashMap<>();
    for (JsonPlanEdge edge : edges) {
        ExecNode<?> source = idToExecNodes.get(edge.getSourceId());
        if (source == null) {
            throw new TableException(String.format("Source node id: %s is not found in nodes.", edge.getSourceId()));
        }
        ExecNode<?> target = idToExecNodes.get(edge.getTargetId());
        if (target == null) {
            throw new TableException(String.format("Target node id: %s is not found in nodes.", edge.getTargetId()));
        }
        ExecEdge execEdge = ExecEdge.builder().source(source).target(target).shuffle(edge.getShuffle()).exchangeMode(edge.getExchangeMode()).build();
        idToInputEdges.computeIfAbsent(target.getId(), n -> new ArrayList<>()).add(execEdge);
        idToOutputEdges.computeIfAbsent(source.getId(), n -> new ArrayList<>()).add(execEdge);
    }
    List<ExecNode<?>> rootNodes = new ArrayList<>();
    for (Map.Entry<Integer, ExecNode<?>> entry : idToExecNodes.entrySet()) {
        int id = entry.getKey();
        ExecNode<?> node = entry.getValue();
        // connect input edges
        List<ExecEdge> inputEdges = idToInputEdges.getOrDefault(id, new ArrayList<>());
        node.setInputEdges(inputEdges);
        if (!idToOutputEdges.containsKey(id)) {
            // if the node has no output nodes, it's a root node
            rootNodes.add(node);
        }
    }
    return new ExecNodeGraph(flinkVersion, rootNodes);
}
Also used : JsonCreator(org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator) Sets(org.apache.flink.shaded.guava30.com.google.common.collect.Sets) ExecNodeVisitorImpl(org.apache.flink.table.planner.plan.nodes.exec.visitor.ExecNodeVisitorImpl) TableException(org.apache.flink.table.api.TableException) Set(java.util.Set) HashMap(java.util.HashMap) JsonProperty(org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty) ExecNode(org.apache.flink.table.planner.plan.nodes.exec.ExecNode) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) List(java.util.List) ExecEdge(org.apache.flink.table.planner.plan.nodes.exec.ExecEdge) Preconditions.checkArgument(org.apache.flink.util.Preconditions.checkArgument) ExecNodeVisitor(org.apache.flink.table.planner.plan.nodes.exec.visitor.ExecNodeVisitor) Map(java.util.Map) Internal(org.apache.flink.annotation.Internal) FlinkVersion(org.apache.flink.FlinkVersion) ExecNodeGraph(org.apache.flink.table.planner.plan.nodes.exec.ExecNodeGraph) ExecNodeGraph(org.apache.flink.table.planner.plan.nodes.exec.ExecNodeGraph) TableException(org.apache.flink.table.api.TableException) ExecEdge(org.apache.flink.table.planner.plan.nodes.exec.ExecEdge) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ExecNode(org.apache.flink.table.planner.plan.nodes.exec.ExecNode) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

ArrayList (java.util.ArrayList)15 FlinkVersion (org.apache.flink.FlinkVersion)15 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Internal (org.apache.flink.annotation.Internal)1 Sets (org.apache.flink.shaded.guava30.com.google.common.collect.Sets)1 JsonCreator (org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator)1 JsonProperty (org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty)1 TableException (org.apache.flink.table.api.TableException)1 ExecEdge (org.apache.flink.table.planner.plan.nodes.exec.ExecEdge)1 ExecNode (org.apache.flink.table.planner.plan.nodes.exec.ExecNode)1 ExecNodeGraph (org.apache.flink.table.planner.plan.nodes.exec.ExecNodeGraph)1 ExecNodeVisitor (org.apache.flink.table.planner.plan.nodes.exec.visitor.ExecNodeVisitor)1 ExecNodeVisitorImpl (org.apache.flink.table.planner.plan.nodes.exec.visitor.ExecNodeVisitorImpl)1 Preconditions.checkArgument (org.apache.flink.util.Preconditions.checkArgument)1