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 0C9D2200C0D for ; Tue, 31 Jan 2017 22:13:58 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0B2AF160B5F; Tue, 31 Jan 2017 21:13:58 +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 52AE4160B36 for ; Tue, 31 Jan 2017 22:13:57 +0100 (CET) Received: (qmail 17296 invoked by uid 500); 31 Jan 2017 21:13:56 -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 17285 invoked by uid 99); 31 Jan 2017 21:13:56 -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; Tue, 31 Jan 2017 21:13:56 +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 EE11CC0096 for ; Tue, 31 Jan 2017 21:13:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-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-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id Sq_-5m6jP099 for ; Tue, 31 Jan 2017 21:13:54 +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 09E675F238 for ; Tue, 31 Jan 2017 21:13:54 +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 F0A6BE0479 for ; Tue, 31 Jan 2017 21:13:52 +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 BAD5A25293 for ; Tue, 31 Jan 2017 21:13:51 +0000 (UTC) Date: Tue, 31 Jan 2017 21:13:51 +0000 (UTC) From: "Paul Rogers (JIRA)" To: dev@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] (DRILL-5235) Column alias doubles sort data size when reading a text file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 31 Jan 2017 21:13:58 -0000 Paul Rogers created DRILL-5235: ---------------------------------- Summary: Column alias doubles sort data size when reading a text file Key: DRILL-5235 URL: https://issues.apache.org/jira/browse/DRILL-5235 Project: Apache Drill Issue Type: Improvement Affects Versions: 1.9.0 Reporter: Paul Rogers Priority: Minor Consider a simple query that reads data from a pipe-separated-value file and sorts it. The file has just one column. The query looks something like this: {code} SELECT columns[0] col1 FROM `dfs.data`.`input-file.tbl` ORDER BY col1 {code} Looking at the query plan, we see that a project operator not just creates an alias {{col1}} for {{column\[0]}}, it also makes a *copy*. The particular input file is 20 GB in size and contains just one column. As a result of materializing the alias, data size to the sort doubles to 40 GB. This results in doubling query run time. If the sort must spill to disk, run times increases by a much larger factor. The fix is to treat the alias as an alias, not a materialized copy. {code} { "graph" : [ { "pop" : "fs-scan", "columns" : [ "`columns`[0]" ], }, { "pop" : "project", "@id" : 4, "exprs" : [ { "ref" : "`col1`", "expr" : "`columns`[0]" } ], }, { "pop" : "external-sort", "orderings" : [ { "order" : "ASC", "expr" : "`col1`", "nullDirection" : "UNSPECIFIED" } ], }, { "pop" : "selection-vector-remover", }, { "pop" : "project", }, { "pop" : "screen", } ] } {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)