From issues-return-234099-archive-asf-public=cust-asf.ponee.io@spark.apache.org Mon Aug 19 01:05:02 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id A7CFE180608 for ; Mon, 19 Aug 2019 03:05:01 +0200 (CEST) Received: (qmail 23085 invoked by uid 500); 19 Aug 2019 01:05:01 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@spark.apache.org Received: (qmail 23063 invoked by uid 99); 19 Aug 2019 01:05:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Aug 2019 01:05:01 +0000 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 61A8FE2F9C for ; Mon, 19 Aug 2019 01:05:00 +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 27B96277A8 for ; Mon, 19 Aug 2019 01:05:00 +0000 (UTC) Date: Mon, 19 Aug 2019 01:05:00 +0000 (UTC) From: "Hyukjin Kwon (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (SPARK-28732) org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator - failed to compile: org.codehaus.commons.compiler.CompileException: File 'generated.java' when storing the result of a count aggregation in an integer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SPARK-28732?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] Hyukjin Kwon resolved SPARK-28732. ---------------------------------- Resolution: Cannot Reproduce > org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator - failed = to compile: org.codehaus.commons.compiler.CompileException: File 'generated= .java' when storing the result of a count aggregation in an integer > -------------------------------------------------------------------------= ---------------------------------------------------------------------------= ------------------------------------------------------------------- > > Key: SPARK-28732 > URL: https://issues.apache.org/jira/browse/SPARK-28732 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 2.1.0, 2.2.0, 2.3.0, 2.4.0 > Reporter: Alix M=C3=A9tivier > Priority: Major > > I am using agg function on a dataset, and i want to count the number of l= ines upon grouping columns. I would like to store the result of this count = in an integer, but it fails with this output :=C2=A0 > {code} > [ERROR]: org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator = - failed to compile: org.codehaus.commons.compiler.CompileException: File '= generated.java', Line 89, Column 53: No applicable constructor/method found= for actual parameters "long"; candidates are: "java.lang.Integer(int)", "j= ava.lang.Integer(java.lang.String)" > Here is the line 89 and a few others to understand : > /* 085 */ long value13 =3D i.getLong(5); > /* 086 */ argValue4 =3D value13; > /* 087 */ > /* 088 */ > /* 089 */ final java.lang.Integer value12 =3D false ? null : new java.la= ng.Integer(argValue4); > {code} > =C2=A0 > As per Integer documentation, there is not constructor for the type Long,= so this is why the generated code fails. > Here is my code :=C2=A0 > {code} > org.apache.spark.sql.Dataset ds_row2 =3D ds_conntAggregateRow= _1_Out_1 > .groupBy(org.apache.spark.sql.functions.col("n_name").as("n_nameN"), > org.apache.spark.sql.functions.col("o_year").as("o_yearN")) > .agg(org.apache.spark.sql.functions.count("n_name").as("countN"), > .as(org.apache.spark.sql.Encoders.bean(row2Struct.class)); > {code} > row2Struct=C2=A0class is composed of=C2=A0n_nameN: String,=C2=A0o_yearN: = String,=C2=A0countN: Int > If=C2=A0countN is a Long, code above wont fail > If it is an Int, it works in 1.6 and 2.0, but fails on version 2.1+ > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.14#76016) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org