From issues-return-204703-archive-asf-public=cust-asf.ponee.io@spark.apache.org Fri Oct 12 11:53: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 BF7DE18067A for ; Fri, 12 Oct 2018 11:53:03 +0200 (CEST) Received: (qmail 16410 invoked by uid 500); 12 Oct 2018 09:53: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 16401 invoked by uid 99); 12 Oct 2018 09:53: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; Fri, 12 Oct 2018 09:53: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 5D6FE180A5E for ; Fri, 12 Oct 2018 09:53:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, 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 unzJuJZFnSz6 for ; Fri, 12 Oct 2018 09:53: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 6D9245F404 for ; Fri, 12 Oct 2018 09:53: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 F3748E25B2 for ; Fri, 12 Oct 2018 09:53: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 54F9124DC1 for ; Fri, 12 Oct 2018 09:53:00 +0000 (UTC) Date: Fri, 12 Oct 2018 09:53:00 +0000 (UTC) From: "Apache Spark (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (SPARK-25717) Insert overwrite a recreated external and partitioned table may result in incorrect query results 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-25717?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] Apache Spark reassigned SPARK-25717: ------------------------------------ Assignee: Apache Spark > Insert overwrite a recreated external and partitioned table may result in= incorrect query results > -------------------------------------------------------------------------= ------------------------ > > Key: SPARK-25717 > URL: https://issues.apache.org/jira/browse/SPARK-25717 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 2.3.2 > Reporter: Jinhua Fu > Assignee: Apache Spark > Priority: Major > > Consider the following scenario: > {code:java} > spark.range(100).createTempView("temp") > (0 until 3).foreach { _ =3D> > spark.sql("drop table if exists tableA") > spark.sql("create table if not exists tableA(a int) partitioned by (p i= nt) location 'file:/e:/study/warehouse/tableA'") > spark.sql("insert overwrite table tableA partition(p=3D1) select * from= temp") > spark.sql("select count(1) from tableA where p=3D1").show > } > {code} > We expect the count always be 100, but the actual results are as follows: > {code:java} > +--------+ > |count(1)| > +--------+ > | 100| > +--------+ > +--------+ > |count(1)| > +--------+ > |=C2=A0=C2=A0 200| > +--------+ > +--------+ > |count(1)| > +--------+ > |=C2=A0=C2=A0 300| > +--------+ > {code} > when spark executes an `insert overwrite` command,=C2=A0 it gets the hist= orical partition first, and then delete it from fileSystem. > But for recreated external and partitioned table, the partitions were all= deleted by the `drop=C2=A0 table` command with data unremoved. So the hist= orical data is preserved which lead to the query results incorrect. > =C2=A0 -- 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