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 32420200C00 for ; Wed, 18 Jan 2017 17:58:31 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 30CA1160B44; Wed, 18 Jan 2017 16:58:31 +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 78E1B160B22 for ; Wed, 18 Jan 2017 17:58:30 +0100 (CET) Received: (qmail 52182 invoked by uid 500); 18 Jan 2017 16:58:29 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 52171 invoked by uid 99); 18 Jan 2017 16:58:29 -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; Wed, 18 Jan 2017 16:58:29 +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 1211D18066C for ; Wed, 18 Jan 2017 16:58:29 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] 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 t3Jzbqbp1MaE for ; Wed, 18 Jan 2017 16:58:28 +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 009595FCA2 for ; Wed, 18 Jan 2017 16:58:28 +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 8EA6CE104D for ; Wed, 18 Jan 2017 16:58:27 +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 6FD8724E02 for ; Wed, 18 Jan 2017 16:58:26 +0000 (UTC) Date: Wed, 18 Jan 2017 16:58:26 +0000 (UTC) From: "Paul Rogers (JIRA)" To: dev@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (DRILL-5202) Planner misses opportunity to link sort & filter without remover MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 18 Jan 2017 16:58:31 -0000 Paul Rogers created DRILL-5202: ---------------------------------- Summary: Planner misses opportunity to link sort & filter with= out remover Key: DRILL-5202 URL: https://issues.apache.org/jira/browse/DRILL-5202 Project: Apache Drill Issue Type: Bug Affects Versions: 1.9.0 Reporter: Paul Rogers Priority: Minor Consider the following query: {code} SELECT * FROM (SELECT * FROM `mock`.`mock.json` ORDER BY col1) d WHERE d.co= l1 =3D 'bogus' {code} The data source here is a mock: it simply generates a data set with 10 colu= mns numbered col1 to col10. Then it generates 10,000 rows of data. The plan for this query misses an optimization opportunity. (See plan below= .) The current plan is (abbreviated): * scan * ... * sort * selection vector remover * project * filter * selection vector remover * project * screen Careful inspection shows that this query is very simple. The following step= s would work just as well: * scan * ... * sort * filter * project * screen That is, the filter can handle an input with a selection vector. So, no SVR= is needed between the sort and the filter. Plus, this is a {{SELECT *}} qu= ery, so all the extra projects don't really do anything useful, so they can= be removed where unneeded. The revised plan eliminates an unnecessary data= copy. Of course, the planner should have pushed the filter below the sort. But th= at is DRILL-5200. {code}=20 "graph" : [ { "pop" : "mock-scan", "@id" : 8, ... }, { "pop" : "project", "@id" : 7, "exprs" : [ { "ref" : "`T0=C2=A6=C2=A6*`", "expr" : "`*`" }, { "ref" : "`col1`", "expr" : "`col1`" } ], "child" : 8, ... }, { "pop" : "external-sort", "@id" : 6, "child" : 7, "orderings" : [ { "order" : "ASC", "expr" : "`col1`", "nullDirection" : "UNSPECIFIED" } ], ... }, { "pop" : "selection-vector-remover", "@id" : 5, "child" : 6, ... }, { "pop" : "project", "@id" : 4, "exprs" : [ { "ref" : "`T0=C2=A6=C2=A6*`", "expr" : "`T0=C2=A6=C2=A6*`" } ], "child" : 5, ... }, { "pop" : "filter", "@id" : 3, "child" : 4, ... }, { "pop" : "selection-vector-remover", "@id" : 2, ... }, { "pop" : "project", "@id" : 1, "exprs" : [ { "ref" : "`*`", "expr" : "`T0=C2=A6=C2=A6*`" } ], "child" : 2, ... }, { "pop" : "screen", "@id" : 0, ... } ] -- This message was sent by Atlassian JIRA (v6.3.4#6332)