3

Flink-CEP でパターンを検出するためのコードを以下に示します。

// Generate temperature warnings for each matched warning pattern

DataStream<TemperatureEvent> warnings = tempPatternStream.select(
    (Map<String, MonitoringEvent> pattern) -> {
        TemperatureEvent first = (TemperatureEvent) pattern.get("first");


        return new TemperatureEvent(first.getRackID(), first.getTemperature()) ;
    }
);

Mac で command + F9 を使用してビルドすると、次のエラーが表示されます

Exception in thread "main" org.apache.flink.api.common.functions.InvalidTypesException: The generic type parameters of 'Map' are missing. 
It seems that your compiler has not stored them into the .class file. 
Currently, only the Eclipse JDT compiler preserves the type information necessary to use the lambdas feature type-safely. 
See the documentation for more information about how to compile jobs containing lambda expressions.
    at org.apache.flink.api.java.typeutils.TypeExtractor.validateLambdaGenericParameter(TypeExtractor.java:1316)
    at org.apache.flink.api.java.typeutils.TypeExtractor.validateLambdaGenericParameters(TypeExtractor.java:1302)
    at org.apache.flink.api.java.typeutils.TypeExtractor.getUnaryOperatorReturnType(TypeExtractor.java:346)
    at org.apache.flink.cep.PatternStream.select(PatternStream.java:64)
    at org.stsffap.cep.monitoring.CEPMonitoring.main(CEPMonitoring.java:85

ただし、usignmvn clean installをビルドしてから Control + R で実行すると、出力が表示されます。

  • なぜこれがいつも起こっているのだろうか?

  • それを行う方法はありますか?

PS:しかし、私はEclipse JDTプラグインを使用していますが、それでもログにエラーが表示されています。POM.XML の内容は、

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerId>jdt</compilerId>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.eclipse.tycho</groupId>
                        <artifactId>tycho-compiler-jdt</artifactId>
                        <version>0.21.0</version>
                    </dependency>
                </dependencies>
            </plugin>

提案は大歓迎です。事前に感謝します

4

2 に答える 2