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 2750C200C4C for ; Tue, 21 Mar 2017 06:17:46 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 21E7F160B8F; Tue, 21 Mar 2017 05:17:46 +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 663E1160B76 for ; Tue, 21 Mar 2017 06:17:45 +0100 (CET) Received: (qmail 65707 invoked by uid 500); 21 Mar 2017 05:17:44 -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 65698 invoked by uid 99); 21 Mar 2017 05:17:44 -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; Tue, 21 Mar 2017 05:17:44 +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 1DF4EC03A7 for ; Tue, 21 Mar 2017 05:17:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.451 X-Spam-Level: * X-Spam-Status: No, score=1.451 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652] 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 WLT4xva3uqeE for ; Tue, 21 Mar 2017 05:17:42 +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 838DB5FBBB for ; Tue, 21 Mar 2017 05:17:42 +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 CE29BE00C7 for ; Tue, 21 Mar 2017 05:17:41 +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 88020254D4 for ; Tue, 21 Mar 2017 05:17:41 +0000 (UTC) Date: Tue, 21 Mar 2017 05:17:41 +0000 (UTC) From: "Luke Hutchison (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (FLINK-6114) Type checking fails with generics, even when concrete type of field is not needed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 21 Mar 2017 05:17:46 -0000 [ https://issues.apache.org/jira/browse/FLINK-6114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15934109#comment-15934109 ] Luke Hutchison edited comment on FLINK-6114 at 3/21/17 5:17 AM: ---------------------------------------------------------------- Hi Greg, the code that caused the exception was doing the following, if memory serves correctly: {code} public static DataSet> doSomething( DataSet> input) { return input.groupBy(0).sum(2); } {code} although I realize now that this leaves field 1 in an indeterminate state: if not all fields of a tuple are covered in the {{groupBy}} and {{sum}} parameters, and if different input tuples have different values for the unspecified fields, then aggregation has to either pick one of the field 1 values, or pick none of them (e.g. set field 1 to null). I assume that this is what caused the exception, because the typechecker was not expecting any fields to be dropped like this -- but if so, the correct exception message would be something along the lines of {{"sum aggregation on field 2 after grouping by field 0 leaves field 1 undefined"}} (or similar). was (Author: lukehutch): Hi Greg, the code that caused the exception was doing the following, if memory serves correctly: {{code}} public static DataSet> doSomething( DataSet> input) { return input.groupBy(0).sum(2); } {{code}} although I realize now that this leaves field 1 in an indeterminate state: if not all fields of a tuple are covered in the {{groupBy}} and {{sum}} parameters, and if different input tuples have different values for the unspecified fields, then aggregation has to either pick one of the field 1 values, or pick none of them (e.g. set field 1 to null). I assume that this is what caused the exception, because the typechecker was not expecting any fields to be dropped like this -- but if so, the correct exception message would be something along the lines of "sum aggregation on field 2 after grouping by field 0 leaves field 1 undefined" (or similar). > Type checking fails with generics, even when concrete type of field is not needed > --------------------------------------------------------------------------------- > > Key: FLINK-6114 > URL: https://issues.apache.org/jira/browse/FLINK-6114 > Project: Flink > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0 > Reporter: Luke Hutchison > > The Flink type checker does not allow generic types to be used in any field of a tuple when a join is being executed, even if the generic is not in a field that is involved in the join. > I have a type Tuple3, which contains a generic type parameter K. I am joining using .where(0).equalTo(0). The type of field 0 is well-defined as String. However, this gives me the following error: > {noformat} > Exception in thread "main" org.apache.flink.api.common.functions.InvalidTypesException: Type of TypeVariable 'K' in 'public static org.apache.flink.api.java.DataSet mypkg.MyClass.method(params)' could not be determined. This is most likely a type erasure problem. The type extraction currently supports types with generic variables only in cases where all variables in the return type can be deduced from the input type(s). > at org.apache.flink.api.java.typeutils.TypeExtractor.createSubTypesInfo(TypeExtractor.java:989) > {noformat} > The code compiles fine, however -- the static type system is able to correctly resolve the types in the surrounding code. > Really only the fields that are affected by joins (or groupBy, aggregation etc.) should be checked for concrete types in this way. -- This message was sent by Atlassian JIRA (v6.3.15#6346)