From issues-return-206107-archive-asf-public=cust-asf.ponee.io@spark.apache.org Sun Oct 28 18:09:04 2018 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 [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id ADC62180671 for ; Sun, 28 Oct 2018 18:09:03 +0100 (CET) Received: (qmail 64230 invoked by uid 500); 28 Oct 2018 17:09:02 -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 64221 invoked by uid 99); 28 Oct 2018 17:09:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Oct 2018 17:09:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 26CD218E39B for ; Sun, 28 Oct 2018 17:09:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Xp24cHSDMYHe for ; Sun, 28 Oct 2018 17:09:01 +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 B77305F366 for ; Sun, 28 Oct 2018 17:09:00 +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 4F952E00EA for ; Sun, 28 Oct 2018 17:09: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 10F5E2183F for ; Sun, 28 Oct 2018 17:09:00 +0000 (UTC) Date: Sun, 28 Oct 2018 17:09:00 +0000 (UTC) From: "Dongjoon Hyun (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (SPARK-25816) Functions does not resolve Columns correctly 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-25816?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] Dongjoon Hyun updated SPARK-25816: ---------------------------------- Affects Version/s: 2.4.0 > Functions does not resolve Columns correctly > -------------------------------------------- > > Key: SPARK-25816 > URL: https://issues.apache.org/jira/browse/SPARK-25816 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 2.3.0, 2.3.1, 2.3.2, 2.4.0 > Reporter: Brian Zhang > Priority: Critical > Attachments: final_allDatatypes_Spark.avro, source.snappy.parquet > > > When=C2=A0there is a duplicate column name in the=C2=A0current Dataframe = and orginal Dataframe where current df is selected from, Spark in 2.3.0 and= 2.3.1 does not resolve the column correctly when using it in the expressio= n, hence causing casting issue.=C2=A0The same code is working in Spark 2.2.= 1 > Please see below code to reproduce the issue > import org.apache.spark._ > import org.apache.spark.rdd._ > import org.apache.spark.storage.StorageLevel._ > import org.apache.spark.sql._ > import org.apache.spark.sql.DataFrame > import org.apache.spark.sql.types._ > import org.apache.spark.sql.functions._ > import org.apache.spark.sql.catalyst.expressions._ > import org.apache.spark.sql.Column > val v0 =3D spark.read.parquet("/data/home/bzinfa/bz/source.snappy.parquet= ") > val v00 =3D v0.toDF(v0.schema.fields.indices.view.map("" + _):_*) > val v5 =3D v00.select($"13".as("0"),$"14".as("1"),$"15".as("2")) > val v5_2 =3D $"2" > v5.where(lit(500).<(v5_2(new Column(new MapKeys(v5_2.expr))(lit(0))))) > //v00's 3rdcolumn is binary and 16th is map > Error: > org.apache.spark.sql.AnalysisException: cannot resolve 'map_keys(`2`)' du= e to data type mismatch: argument 1 requires map type, however, '`2`' is of= binary type.; > =C2=A0 > =C2=A0'Project [0#1591, 1#1592, 2#1593] +- 'Filter (500 < {color:#FF0000}= 2#1593{color}[map_keys({color:#FF0000}2#1561{color})[0]]) +- Project [13#15= 72 AS 0#1591, 14#1573 AS 1#1592, 15#1574 AS 2#1593, 2#1561] +- Project [c_b= ytes#1527 AS 0#1559, c_union#1528 AS 1#1560, c_fixed#1529 AS 2#1561, c_bool= ean#1530 AS 3#1562, c_float#1531 AS 4#1563, c_double#1532 AS 5#1564, c_int#= 1533 AS 6#1565, c_long#1534L AS 7#1566L, c_string#1535 AS 8#1567, c_decimal= _18_2#1536 AS 9#1568, c_decimal_28_2#1537 AS 10#1569, c_decimal_38_2#1538 A= S 11#1570, c_date#1539 AS 12#1571, simple_struct#1540 AS 13#1572, simple_ar= ray#1541 AS 14#1573, simple_map#1542 AS 15#1574] +- Relation[c_bytes#1527,c= _union#1528,c_fixed#1529,c_boolean#1530,c_float#1531,c_double#1532,c_int#15= 33,c_long#1534L,c_string#1535,c_decimal_18_2#1536,c_decimal_28_2#1537,c_dec= imal_38_2#1538,c_date#1539,simple_struct#1540,simple_array#1541,simple_map#= 1542] parquet -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org