Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 035B6200CAF for ; Wed, 7 Jun 2017 16:07:27 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 01E0A160BEA; Wed, 7 Jun 2017 14:07:27 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 20252160BD0 for ; Wed, 7 Jun 2017 16:07:25 +0200 (CEST) Received: (qmail 70161 invoked by uid 500); 7 Jun 2017 14:07:25 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 69980 invoked by uid 99); 7 Jun 2017 14:07:24 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jun 2017 14:07:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id B12B9C090B for ; Wed, 7 Jun 2017 14:07:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id ZcOuFlcSySu7 for ; Wed, 7 Jun 2017 14:07:21 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 431725FD3F for ; Wed, 7 Jun 2017 14:07:21 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 80C51E0DEA for ; Wed, 7 Jun 2017 14:07:20 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 6A6F021E27 for ; Wed, 7 Jun 2017 14:07:19 +0000 (UTC) Date: Wed, 7 Jun 2017 14:07:19 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-6783) Wrongly extracted TypeInformations for WindowedStream::aggregate MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 07 Jun 2017 14:07:27 -0000 [ https://issues.apache.org/jira/browse/FLINK-6783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16040933#comment-16040933 ] ASF GitHub Bot commented on FLINK-6783: --------------------------------------- Github user dawidwys commented on a diff in the pull request: https://github.com/apache/flink/pull/4039#discussion_r120555933 --- Diff: flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java --- @@ -574,13 +574,15 @@ public ExecutionConfig getExecutionConfig() { public SingleOutputStreamOperator process(ProcessFunction processFunction) { TypeInformation outType = TypeExtractor.getUnaryOperatorReturnType( - processFunction, - ProcessFunction.class, - false, - true, - getType(), - Utils.getCallLocationName(), - true); + processFunction, + ProcessFunction.class, + 0, + 1, + new int[]{0}, --- End diff -- I think it is lambda > Wrongly extracted TypeInformations for WindowedStream::aggregate > ---------------------------------------------------------------- > > Key: FLINK-6783 > URL: https://issues.apache.org/jira/browse/FLINK-6783 > Project: Flink > Issue Type: Bug > Components: Core, DataStream API > Affects Versions: 1.3.0, 1.3.1 > Reporter: Dawid Wysakowicz > Assignee: Dawid Wysakowicz > Priority: Blocker > Labels: flink-rel-1.3.1-blockers > Fix For: 1.3.1 > > > The following test fails because of wrongly acquired output type for {{AggregateFunction}}: > {code} > @Test > public void testAggregateWithWindowFunctionDifferentResultTypes() throws Exception { > StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); > DataStream> source = env.fromElements(Tuple2.of("hello", 1), Tuple2.of("hello", 2)); > DataStream> window = source > .keyBy(new TupleKeySelector()) > .window(TumblingEventTimeWindows.of(Time.of(1, TimeUnit.SECONDS))) > .aggregate(new AggregateFunction, Tuple2, String>() { > @Override > public Tuple2 createAccumulator() { > return Tuple2.of("", 0); > } > @Override > public void add( > Tuple2 value, Tuple2 accumulator) { > } > @Override > public String getResult(Tuple2 accumulator) { > return accumulator.f0; > } > @Override > public Tuple2 merge( > Tuple2 a, Tuple2 b) { > return Tuple2.of("", 0); > } > }, new WindowFunction, String, TimeWindow>() { > @Override > public void apply( > String s, > TimeWindow window, > Iterable input, > Collector> out) throws Exception { > out.collect(Tuple3.of("", "", 0)); > } > }); > OneInputTransformation, Tuple3> transform = > (OneInputTransformation, Tuple3>) window.getTransformation(); > OneInputStreamOperator, Tuple3> operator = transform.getOperator(); > Assert.assertTrue(operator instanceof WindowOperator); > WindowOperator, ?, ?, ?> winOperator = > (WindowOperator, ?, ?, ?>) operator; > Assert.assertTrue(winOperator.getTrigger() instanceof EventTimeTrigger); > Assert.assertTrue(winOperator.getWindowAssigner() instanceof TumblingEventTimeWindows); > Assert.assertTrue(winOperator.getStateDescriptor() instanceof AggregatingStateDescriptor); > processElementAndEnsureOutput( > operator, winOperator.getKeySelector(), BasicTypeInfo.STRING_TYPE_INFO, new Tuple2<>("hello", 1)); > } > {code} > The test results in > {code} > org.apache.flink.api.common.functions.InvalidTypesException: Input mismatch: Tuple type expected. > at org.apache.flink.api.java.typeutils.TypeExtractor.validateInputType(TypeExtractor.java:1157) > at org.apache.flink.api.java.typeutils.TypeExtractor.getUnaryOperatorReturnType(TypeExtractor.java:451) > at org.apache.flink.streaming.api.datastream.WindowedStream.aggregate(WindowedStream.java:855) > at org.apache.flink.streaming.runtime.operators.windowing.WindowTranslationTest.testAggregateWithWindowFunctionDifferentResultTypes(WindowTranslationTest.java:702) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) > at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) > at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) > at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) > at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) > at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51) > at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) > at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) > Caused by: org.apache.flink.api.common.functions.InvalidTypesException: Tuple type expected. > at org.apache.flink.api.java.typeutils.TypeExtractor.validateInfo(TypeExtractor.java:1204) > at org.apache.flink.api.java.typeutils.TypeExtractor.validateInputType(TypeExtractor.java:1154) > ... 25 more > {code} > I tracked down the issue and the reason is wrongly handled {{outputTypeArgumentIndex}} in {{TypeExtractor::getUnaryOperatorReturnType}}. > My proposition is to remove/deprecate version of {{TypeExtractor::getUnaryOperatorReturnType}} that accepts {{hasIterable}} and {{hasCollector}} as parameters and move all invocations to explicitly passing index of output type (after fixing {{outputTypeArgumentIndex}} handling in line {{TypeExtractor:455}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)