Return-Path: X-Original-To: apmail-spark-issues-archive@minotaur.apache.org Delivered-To: apmail-spark-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7AF9917A51 for ; Tue, 16 Feb 2016 07:11:18 +0000 (UTC) Received: (qmail 4774 invoked by uid 500); 16 Feb 2016 07:11:18 -0000 Delivered-To: apmail-spark-issues-archive@spark.apache.org Received: (qmail 4734 invoked by uid 500); 16 Feb 2016 07:11:18 -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 4658 invoked by uid 99); 16 Feb 2016 07:11:18 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Feb 2016 07:11:18 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 127C02C14F4 for ; Tue, 16 Feb 2016 07:11:18 +0000 (UTC) Date: Tue, 16 Feb 2016 07:11:18 +0000 (UTC) From: "Xiao Li (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SPARK-13333) DataFrame filter + randn + unionAll has bad interaction MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SPARK-13333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15148182#comment-15148182 ] Xiao Li commented on SPARK-13333: --------------------------------- This is a known issue. The same issue exists in CTE with non-deterministic expression. For example, the following query could return a wrong result. {code} With q as (select * from testData limit 10) select * from q as q1 inner join q as q2 where q1.key = q2.key {code} We need to materialize it before doing self unionall/join/intersect like operations. > DataFrame filter + randn + unionAll has bad interaction > ------------------------------------------------------- > > Key: SPARK-13333 > URL: https://issues.apache.org/jira/browse/SPARK-13333 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 1.4.2, 1.6.1, 2.0.0 > Reporter: Joseph K. Bradley > > Buggy workflow > * Create a DataFrame df0 > * Filter df0 > * Add a randn column > * Create a copy of the DataFrame > * unionAll the two DataFrames > This fails, where randn produces the same results on the original DataFrame and the copy before unionAll but fails to do so after unionAll. Removing the filter fixes the problem. > The bug can be reproduced on master: > {code} > import org.apache.spark.sql.functions.randn > val df0 = sqlContext.createDataFrame(Seq(0, 1).map(Tuple1(_))).toDF("id") > // Removing the following filter() call makes this give the expected result. > val df1 = df0.filter(col("id") === 0).withColumn("b", randn(12345)) > println("DF1") > df1.show() > val df2 = df1.select("id", "b") > println("DF2") > df2.show() // same as df1.show(), as expected > val df3 = df1.unionAll(df2) > println("DF3") > df3.show() // NOT two copies of df1, which is unexpected > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org