From issues-return-201381-archive-asf-public=cust-asf.ponee.io@spark.apache.org Sun Sep 9 18:11:05 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 A140018077A for ; Sun, 9 Sep 2018 18:11:04 +0200 (CEST) Received: (qmail 5775 invoked by uid 500); 9 Sep 2018 16:11:03 -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 5738 invoked by uid 99); 9 Sep 2018 16:11:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Sep 2018 16:11:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 07D541A0823 for ; Sun, 9 Sep 2018 16:11:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-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 (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id aN6r33RVMePy for ; Sun, 9 Sep 2018 16:11:02 +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 D65085F525 for ; Sun, 9 Sep 2018 16:11:01 +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 3E220E2633 for ; Sun, 9 Sep 2018 16:11:01 +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 85C7E26B5F for ; Sun, 9 Sep 2018 16:11:00 +0000 (UTC) Date: Sun, 9 Sep 2018 16:11:00 +0000 (UTC) From: "Xiao Li (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (SPARK-25368) Incorrect predicate pushdown returns wrong result 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-25368?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiao Li reassigned SPARK-25368: ------------------------------- Assignee: Yuming Wang > Incorrect predicate pushdown returns wrong result > ------------------------------------------------- > > Key: SPARK-25368 > URL: https://issues.apache.org/jira/browse/SPARK-25368 > Project: Spark > Issue Type: Bug > Components: Optimizer, SQL > Affects Versions: 2.3.1, 2.3.2 > Reporter: Lev Katzav > Assignee: Yuming Wang > Priority: Blocker > Labels: correctness > Fix For: 2.3.2, 2.4.0 > > Attachments: plan.txt > > > there is a breaking change in spark 2.3 (I checked on 2.3.1 and 2.3.2-rc5= ) > the following code recreates the=C2=A0problem > (it's a bit convoluted examples, I tried to simplify it as much as possi= ble from my code) > {code:java} > import org.apache.spark.sql.{DataFrame, SQLContext} > import org.apache.spark.sql.expressions.Window > import org.apache.spark.sql.functions._ > import spark.implicits._ > case class Data(a: Option[Int],b: String,c: Option[String],d: String) > val df1 =3D spark.createDataFrame(Seq( > Data(Some(1), "1", None, "1"), > Data(None, "2", Some("2"), "2") > )) > val df2 =3D df1 > .where( $"a".isNotNull) > .withColumn("e", lit(null).cast("string")) > val columns =3D df2.columns.map(c =3D> col(c)) > val df3 =3D df1 > .select( > $"c", > $"b" as "e" > ) > .withColumn("a", lit(null).cast("int")) > .withColumn("b", lit(null).cast("string")) > .withColumn("d", lit(null).cast("string")) > .select(columns :_*) > val df4 =3D > df2.union(df3) > .withColumn("e", last(col("e"), ignoreNulls =3D true).over(Window.parti= tionBy($"c").orderBy($"d"))) > .filter($"a".isNotNull) > df4.show > {code} > =C2=A0 > notice that the last statement in for df4 is to filter rows where a is nu= ll > in spark 2.2.1, the above code prints: > {code:java} > +---+---+----+---+---+=20 > | a| b| c| d| e| > +---+---+----+---+---+=20 > | 1| 1|null| 1| 1|=20 > +---+---+----+---+---+ > {code} > in spark 2.3.x, it prints:=C2=A0 > {code:java} > +----+----+----+----+---+=20 > | a| b| c| d| e|=20 > +----+----+----+----+---+=20 > |null|null|null|null| 1|=20 > | 1| 1|null| 1| 1|=20 > |null|null| 2|null| 2| > +----+----+----+----+---+ > {code} > =C2=A0the column a still contains null values > =C2=A0 > attached are the plans. > in the parsed logical plan, the=C2=A0filter for=C2=A0isnotnull('a), is on= top, > but in the optimized logical plan, it is pushed down -- 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