Return-Path: X-Original-To: apmail-flink-user-archive@minotaur.apache.org Delivered-To: apmail-flink-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 20AA618449 for ; Thu, 3 Mar 2016 20:17:32 +0000 (UTC) Received: (qmail 97854 invoked by uid 500); 3 Mar 2016 20:17:26 -0000 Delivered-To: apmail-flink-user-archive@flink.apache.org Received: (qmail 97760 invoked by uid 500); 3 Mar 2016 20:17:26 -0000 Mailing-List: contact user-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@flink.apache.org Delivered-To: mailing list user@flink.apache.org Received: (qmail 97750 invoked by uid 99); 3 Mar 2016 20:17:26 -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; Thu, 03 Mar 2016 20:17:26 +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 7273FC06C5 for ; Thu, 3 Mar 2016 20:17:26 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.299 X-Spam-Level: * X-Spam-Status: No, score=1.299 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=braintreepayments-com.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id n38BTTGyGwsL for ; Thu, 3 Mar 2016 20:17:23 +0000 (UTC) Received: from mail-io0-f176.google.com (mail-io0-f176.google.com [209.85.223.176]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id ED2395F3F1 for ; Thu, 3 Mar 2016 20:17:22 +0000 (UTC) Received: by mail-io0-f176.google.com with SMTP id l127so40167525iof.3 for ; Thu, 03 Mar 2016 12:17:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braintreepayments-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=Vu5CLm4m1p72tUIr7qeigGAxDrHIB2jqRVkgHQlZtvQ=; b=LPFPBgPos0OyiJDZH2aOnFCKp5a3Hx1fU8061gdZ6C/gFkv+hVB+JwFsglh3F1CxaK 8Hs6iOzsKYbxniDnipvV0Vlr138B4LLnxecVPzWGcDP1+MEYvYzeU4zGDofx/XIjbrrx QHMck3p1siHsXXvRJJ08aH+i8Z8w+j+P3Tqm4BjafFzQTI+kpdlK3hzx7x2RzN28a5H+ Yc22N/Js+lbn9jFxm3f8HrUmyEXKEchiwY0+1LkgHEXkzQjTzwvaq5VkTKA8BlFpnECi EG3SHHF9CPkAY/PMLGgNcHVi8E+R2aEE8hc93QffdICqseWuXC1s+x26UIV5zcf12PDd aYjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=Vu5CLm4m1p72tUIr7qeigGAxDrHIB2jqRVkgHQlZtvQ=; b=Hd7nwhT5zXaLp8ESFzKD7HAguRSthWClCNObKqsh4rOVKGCsWDcOA5npc4zEPnoNNq Oul5PqDEM67+sn5Ocnxa6F/zvEOh16KqQm3XmzltArTpbp8G6kf+G0Lgv7OP8surEJ9M 403Lvc/xVZMVfJKu5bSaNjGgYnMMPW061jzkFIpKliBnlpRCoOBSmOKspvT4D2NL2u52 kHiGehhULtE4RrrdaCSgrgyzgK9g7miqTVIjEuGSrC7gWiQZxFs4pnj6tN8YcZNK+76F qidBLvJViJ3pDedElMF6f+792PBHEVFozkG2nXaZofy27ZYzIZVkWHD4i4b/C6vS75CQ oy8w== X-Gm-Message-State: AD7BkJJS9Zk8YKDtZvJTSIZ2fh4W1jjgcrbqj59P5B2/Ol3OZE16Cnxa13M87r82ht/HlwMzE1AsRth9Zi3bfkfg MIME-Version: 1.0 X-Received: by 10.107.1.196 with SMTP id 187mr5321696iob.184.1457036236129; Thu, 03 Mar 2016 12:17:16 -0800 (PST) Received: by 10.107.34.146 with HTTP; Thu, 3 Mar 2016 12:17:16 -0800 (PST) In-Reply-To: References: Date: Thu, 3 Mar 2016 14:17:16 -0600 Message-ID: Subject: Re: Compilation error with Scala case class with private constructor From: Andrew Whitaker To: user@flink.apache.org Content-Type: multipart/alternative; boundary=001a113988d247ce36052d2aaf1f --001a113988d247ce36052d2aaf1f Content-Type: text/plain; charset=UTF-8 Thanks for the quick response, Stephen, that makes sense. > Is it a problem for your use case to make the constructor public? It's not a huge problem, I was mostly just curious as to what the problem was exactly. On Thu, Mar 3, 2016 at 2:14 PM, Stephan Ewen wrote: > Hi! > > My guess is that this error is indirectly reporting that no > TypeInformation could be generated for the case class. That TypeInformation > is generated using macros during program compilation. > > The generated TypeInformation will contain a partially code-generated > serializer including the code to instantiate the case class upon > deserialization. That generated code at some point calls the constructor > and thus probably fails to compile when the constructor is private. As a > result, no TypeInformation will be created, and then Scala cannot provide > one for the implicit parameter. > > I think Aljoscha can probably give a deeper insight into the > TypeInformation generator for Scala. > > Is it a problem for your use case to make the constructor public? > > Greetings, > Stephan > > > On Thu, Mar 3, 2016 at 9:06 PM, Andrew Whitaker < > andrew.whitaker@braintreepayments.com> wrote: > >> Hi, >> >> I've run up against a compilation error involving a case class with a >> private constructor: >> >> [error] >> /Users/anwhitaker/code/flink-fold-issue/src/main/scala/TestApp.scala:18: >> could not find implicit value for evidence parameter of type >> org.apache.flink.api.common.typeinfo.TypeInformation[List[scala.util.Try[TestApp.Wrapper]]] >> [error] .fold(List[Try[Wrapper]](), new FoldFunction[Tuple2[Int, >> Int], List[Try[Wrapper]]] { >> [error] ^ >> [error] one error found >> [error] (compile:compileIncremental) Compilation failed >> >> If I make the constructor public again, the error goes away. I've set up >> a simple example that demonstrates the problem here: >> https://github.com/AndrewWhitaker/flink-case-class-private-ctor >> I've read this article on Flink's website: >> https://flink.apache.org/faq.html#why-am-i-getting-a-nonserializableexception- >> but I think my issue is slightly different. >> >> I'm just trying to understand this behavior and if there's a way I can >> work around it. >> >> Thanks! >> >> -- >> Andrew Whitaker | andrew.whitaker@braintreepayments.com >> > > -- Andrew Whitaker | andrew.whitaker@braintreepayments.com -- Note: this information is confidential. It is prohibited to share, post online or otherwise publicize without Braintree's prior written consent. --001a113988d247ce36052d2aaf1f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks for the quick response, Stephen, that makes sense.<= div>
>=C2=A0Is it a probl= em for your use case to make the constructor public?

It's not a huge problem, I was mostly just curious as to what t= he problem was exactly.

On Thu, Mar 3, 2016 at 2:14 PM, Stephan Ewen <sewe= n@apache.org> wrote:
Hi!

My guess is that this error is indirectly= reporting that no TypeInformation could be generated for the case class. T= hat TypeInformation is generated using macros during program compilation.

The generated TypeInformation will contain a partia= lly code-generated serializer including the code to instantiate the case cl= ass upon deserialization. That generated code at some point calls the const= ructor and thus probably fails to compile when the constructor is private. = As a result, no TypeInformation will be created, and then Scala cannot prov= ide one for the implicit parameter.

I think Aljosc= ha can probably give a deeper insight into the TypeInformation generator fo= r Scala.

Is it a problem for your use case to make= the constructor public?

Greetings,
Step= han


On Thu, Mar 3, 2016 at= 9:06 PM, Andrew Whitaker <andrew.whitaker@braintreepa= yments.com> wrote:
Hi,

I've run up against a compilation error= involving a case class with a private constructor:

[error] /Users/anwhitaker/code/flink-fold-issue/src/main/scala/TestA= pp.scala:18: could not find implicit value for evidence parameter of type o= rg.apache.flink.api.common.typeinfo.TypeInformation[List[scala.util.Try[Tes= tApp.Wrapper]]]
[error] =C2=A0 =C2=A0 =C2=A0 .fold(List[Try[Wrapp= er]](), new FoldFunction[Tuple2[Int, Int], List[Try[Wrapper]]] {
= [error] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^
[error] one er= ror found
[error] (compile:compileIncremental) Compilation failed=

If I make the constructor public again, the= error goes away. I've set up a simple example that demonstrates the pr= oblem here:=C2=A0https://github.com/AndrewWhitaker/flink= -case-class-private-ctor
I've read this article on Flink&= #39;s website:=C2=A0https://flink.apache.= org/faq.html#why-am-i-getting-a-nonserializableexception- but I think m= y issue is slightly different.

I'm just tr= ying to understand this behavior and if there's a way I can work around= it.

Thanks!

--




--
=
--
Note: this information is confidentia= l. It is prohibited to share, post online or otherwise publicize without Br= aintree's prior written consent.
--001a113988d247ce36052d2aaf1f--