From issues-return-183191-archive-asf-public=cust-asf.ponee.io@spark.apache.org Sat Jan 27 07:36:05 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id A409F18065B for ; Sat, 27 Jan 2018 07:36:05 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 940F2160C30; Sat, 27 Jan 2018 06:36:05 +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 DB2B3160C2F for ; Sat, 27 Jan 2018 07:36:04 +0100 (CET) Received: (qmail 78404 invoked by uid 500); 27 Jan 2018 06:36:04 -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 78394 invoked by uid 99); 27 Jan 2018 06:36: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; Sat, 27 Jan 2018 06:36: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 732E51A0E22 for ; Sat, 27 Jan 2018 06:36:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -102.311 X-Spam-Level: X-Spam-Status: No, score=-102.311 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id hoMbnIYtUR2a for ; Sat, 27 Jan 2018 06:36:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 100595F30C for ; Sat, 27 Jan 2018 06:36: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 466ABE008D for ; Sat, 27 Jan 2018 06:36: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 058E7240EA for ; Sat, 27 Jan 2018 06:36:00 +0000 (UTC) Date: Sat, 27 Jan 2018 06:36:00 +0000 (UTC) From: "caoxuewen (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (SPARK-23247) combines Unsafe operations and statistics operations in Scan Data Source MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 caoxuewen created SPARK-23247: --------------------------------- Summary: combines Unsafe operations and statistics operations = in Scan Data Source Key: SPARK-23247 URL: https://issues.apache.org/jira/browse/SPARK-23247 Project: Spark Issue Type: Improvement Components: SQL Affects Versions: 2.3.0 Reporter: caoxuewen Currently, we scan the execution plan of the data source, first the unsafe = operation of each row of data, and then re traverse the data for the count = of rows. In terms of performance, this is not necessary. this PR combines t= he two operations and makes statistics on the number of rows while performi= ng the unsafe operation. *Before modified,* {color:#cc7832}val {color}unsafeRow =3D rdd.mapPartitionsWithIndexInternal = { (index{color:#cc7832}, {color}iter) =3D> {color:#cc7832}val {color}proj =3D UnsafeProjection.create({color:#9876aa}= schema{color}) proj.initialize(index) {color:#FF0000}iter.map(proj){color} } {color:#cc7832}val {color}numOutputRows =3D longMetric({color:#6a8759}"numO= utputRows"{color}) unsafeRow.map { r =3D> {color:#FF0000}numOutputRows +=3D {color}{color:#6897bb}{color:#FF0000}1{c= olor} {color} r } *After modified,* =C2=A0=C2=A0=C2=A0 val numOutputRows =3D longMetric("numOutputRows") =C2=A0=C2=A0=C2=A0 rdd.mapPartitionsWithIndexInternal { (index, iter) =3D> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 val proj =3D UnsafeProjection.create(schema) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 proj.initialize(index) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 iter.map( r =3D> { {color:#FF0000}=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 numOutputRows += =3D 1{color} {color:#FF0000}=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 proj(r){color} =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }) =C2=A0=C2=A0=C2=A0 } =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