Search in sources :

Example 61 with VisibleForTesting

use of org.apache.flink.annotation.VisibleForTesting in project flink by apache.

the class AWSAsyncSinkUtil method createAwsAsyncClient.

@VisibleForTesting
static <S extends SdkClient, T extends AwsAsyncClientBuilder<? extends T, S> & AwsClientBuilder<? extends T, S>> S createAwsAsyncClient(final Properties configProps, final T clientBuilder, final SdkAsyncHttpClient httpClient, final ClientOverrideConfiguration overrideConfiguration) {
    if (configProps.containsKey(AWSConfigConstants.AWS_ENDPOINT)) {
        final URI endpointOverride = URI.create(configProps.getProperty(AWSConfigConstants.AWS_ENDPOINT));
        clientBuilder.endpointOverride(endpointOverride);
    }
    return clientBuilder.httpClient(httpClient).overrideConfiguration(overrideConfiguration).credentialsProvider(getCredentialsProvider(configProps)).region(getRegion(configProps)).build();
}
Also used : URI(java.net.URI) VisibleForTesting(org.apache.flink.annotation.VisibleForTesting)

Example 62 with VisibleForTesting

use of org.apache.flink.annotation.VisibleForTesting in project flink by apache.

the class InputPriorityGraphGenerator method calculatePipelinedAncestors.

/**
 * Find the ancestors by going through PIPELINED edges.
 */
@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;
}
Also used : AbstractExecNodeExactlyOnceVisitor(org.apache.flink.table.planner.plan.nodes.exec.visitor.AbstractExecNodeExactlyOnceVisitor) InputProperty(org.apache.flink.table.planner.plan.nodes.exec.InputProperty) ArrayList(java.util.ArrayList) BatchExecNode(org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecNode) ExecNode(org.apache.flink.table.planner.plan.nodes.exec.ExecNode) VisibleForTesting(org.apache.flink.annotation.VisibleForTesting)

Example 63 with VisibleForTesting

use of org.apache.flink.annotation.VisibleForTesting in project flink by apache.

the class CatalogTableStatisticsConverter method convertToColumnStatsMap.

@VisibleForTesting
public static Map<String, ColumnStats> convertToColumnStatsMap(Map<String, CatalogColumnStatisticsDataBase> columnStatisticsData) {
    Map<String, ColumnStats> columnStatsMap = new HashMap<>();
    for (Map.Entry<String, CatalogColumnStatisticsDataBase> entry : columnStatisticsData.entrySet()) {
        if (entry.getValue() != null) {
            ColumnStats columnStats = convertToColumnStats(entry.getValue());
            columnStatsMap.put(entry.getKey(), columnStats);
        }
    }
    return columnStatsMap;
}
Also used : HashMap(java.util.HashMap) CatalogColumnStatisticsDataBase(org.apache.flink.table.catalog.stats.CatalogColumnStatisticsDataBase) ColumnStats(org.apache.flink.table.plan.stats.ColumnStats) CatalogColumnStatisticsDataString(org.apache.flink.table.catalog.stats.CatalogColumnStatisticsDataString) HashMap(java.util.HashMap) Map(java.util.Map) VisibleForTesting(org.apache.flink.annotation.VisibleForTesting)

Example 64 with VisibleForTesting

use of org.apache.flink.annotation.VisibleForTesting in project flink by apache.

the class StreamExecMatch method translatePattern.

@VisibleForTesting
public static Tuple2<Pattern<RowData, RowData>, List<String>> translatePattern(MatchSpec matchSpec, TableConfig tableConfig, RelBuilder relBuilder, RowType inputRowType) {
    final PatternVisitor patternVisitor = new PatternVisitor(tableConfig, relBuilder, inputRowType, matchSpec);
    final Pattern<RowData, RowData> cepPattern;
    if (matchSpec.getInterval().isPresent()) {
        Time interval = translateTimeBound(matchSpec.getInterval().get());
        cepPattern = matchSpec.getPattern().accept(patternVisitor).within(interval);
    } else {
        cepPattern = matchSpec.getPattern().accept(patternVisitor);
    }
    return new Tuple2<>(cepPattern, new ArrayList<>(patternVisitor.names));
}
Also used : RowData(org.apache.flink.table.data.RowData) Tuple2(org.apache.flink.api.java.tuple.Tuple2) Time(org.apache.flink.streaming.api.windowing.time.Time) VisibleForTesting(org.apache.flink.annotation.VisibleForTesting)

Aggregations

VisibleForTesting (org.apache.flink.annotation.VisibleForTesting)64 HashMap (java.util.HashMap)11 IOException (java.io.IOException)8 ArrayList (java.util.ArrayList)7 Configuration (org.apache.flink.configuration.Configuration)7 Map (java.util.Map)6 File (java.io.File)5 URI (java.net.URI)4 List (java.util.List)4 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)4 Field (java.lang.reflect.Field)3 Set (java.util.Set)3 Nullable (javax.annotation.Nullable)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 InputStream (java.io.InputStream)2 Path (java.nio.file.Path)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Matcher (java.util.regex.Matcher)2 MetricGroup (org.apache.flink.metrics.MetricGroup)2 ExecutionJobVertex (org.apache.flink.runtime.executiongraph.ExecutionJobVertex)2