@VisibleForTesting
    List<ExecNode<?>> calculatePipelinedAncestors(ExecNode<?> node) {
        List<ExecNode<?>> ret = new ArrayList<>();
        AbstractExecNodeExactlyOnceVisitor ancestorVisitor =
                new AbstractExecNodeExactlyOnceVisitor() {
                    @Override
                    protected void visitNode(ExecNode<?> node) {
                        boolean hasAncestor = false;

                        if (!boundaries.contains(node)) {
                            List<InputProperty> inputProperties = node.getInputProperties();
                            for (int i = 0; i < inputProperties.size(); i++) {
                                // we only go through PIPELINED edges
                                if (inputProperties
                                        .get(i)
                                        .getDamBehavior()
                                        .stricterOrEqual(safeDamBehavior)) {
                                    continue;
                                }
                                hasAncestor = true;
                                node.getInputEdges().get(i).getSource().accept(this);
                            }
                        }

                        if (!hasAncestor) {
                            ret.add(node);
                        }
                    }
                };
        node.accept(ancestorVisitor);
        return ret;
    }
@Test
    void testCalculateBoundedPipelinedAncestors() {
        // P = InputProperty.DamBehavior.PIPELINED, E = InputProperty.DamBehavior.END_INPUT
        //
        // 0 -P-> 1 -P-> 2
        // 3 -P-> 4 -E/
        TestingBatchExecNode[] nodes = new TestingBatchExecNode[5];
        for (int i = 0; i < nodes.length; i++) {
            nodes[i] = new TestingBatchExecNode("TestingBatchExecNode" + i);
        }
        nodes[1].addInput(nodes[0]);
        nodes[2].addInput(nodes[1]);
        nodes[2].addInput(
                nodes[4],
                InputProperty.builder().damBehavior(InputProperty.DamBehavior.END_INPUT).build());
        nodes[4].addInput(nodes[3]);

        TestingInputPriorityConflictResolver resolver =
                new TestingInputPriorityConflictResolver(
                        Collections.singletonList(nodes[2]),
                        new HashSet<>(Collections.singleton(nodes[1])),
                        InputProperty.DamBehavior.END_INPUT);
        List<ExecNode<?>> ancestors = resolver.calculatePipelinedAncestors(nodes[2]);
        assertThat(ancestors).hasSize(1);
        assertThat(ancestors).contains(nodes[1]);
    }