Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DB143200CCC for ; Thu, 6 Jul 2017 19:07:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D9BB9166EEA; Thu, 6 Jul 2017 17:07:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2CEC0166EEB for ; Thu, 6 Jul 2017 19:07:04 +0200 (CEST) Received: (qmail 96730 invoked by uid 500); 6 Jul 2017 17:07: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 96631 invoked by uid 99); 6 Jul 2017 17:07:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jul 2017 17:07:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id CE982C00B6 for ; Thu, 6 Jul 2017 17:07:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id nyFO0CLM3Ppy for ; Thu, 6 Jul 2017 17:07: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 95FC55FD0C for ; Thu, 6 Jul 2017 17:07: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 0E823E0D51 for ; Thu, 6 Jul 2017 17:07: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 3D97924678 for ; Thu, 6 Jul 2017 17:07:00 +0000 (UTC) Date: Thu, 6 Jul 2017 17:07:00 +0000 (UTC) From: "Wenchen Fan (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (SPARK-21228) InSet incorrect handling of structs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 06 Jul 2017 17:07:05 -0000 [ https://issues.apache.org/jira/browse/SPARK-21228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Wenchen Fan resolved SPARK-21228. --------------------------------- Resolution: Fixed Fix Version/s: 2.3.0 > InSet incorrect handling of structs > ----------------------------------- > > Key: SPARK-21228 > URL: https://issues.apache.org/jira/browse/SPARK-21228 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 2.2.0 > Reporter: Bogdan Raducanu > Assignee: Bogdan Raducanu > Fix For: 2.3.0 > > > In InSet it's possible that hset contains GenericInternalRows while child returns UnsafeRows (and vice versa). InSet uses hset.contains (both in doCodeGen and eval) which will always be false in this case. > The following code reproduces the problem: > {code} > spark.conf.set("spark.sql.optimizer.inSetConversionThreshold", "2") // the default is 10 which requires a longer query text to repro > spark.range(1, 10).selectExpr("named_struct('a', id, 'b', id) as a").createOrReplaceTempView("A") > sql("select * from (select min(a) as minA from A) A where minA in (named_struct('a', 1L, 'b', 1L),named_struct('a', 2L, 'b', 2L),named_struct('a', 3L, 'b', 3L))").show // the Aggregate here will return UnsafeRows while the list of structs that will become hset will be GenericInternalRows > +----+ > |minA| > +----+ > +----+ > {code} > In.doCodeGen uses compareStructs and seems to work. In.eval might not work but not sure how to reproduce. > {code} > spark.conf.set("spark.sql.optimizer.inSetConversionThreshold", "3") // now it will not use InSet > sql("select * from (select min(a) as minA from A) A where minA in (named_struct('a', 1L, 'b', 1L),named_struct('a', 2L, 'b', 2L),named_struct('a', 3L, 'b', 3L))").show > +-----+ > | minA| > +-----+ > |[1,1]| > +-----+ > {code} > Solution could be either to do safe<->unsafe conversion in InSet or not trigger InSet optimization at all in this case. > Need to investigate if In.eval is affected. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org