Return-Path: X-Original-To: apmail-drill-dev-archive@www.apache.org Delivered-To: apmail-drill-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CC95E18CDC for ; Wed, 23 Mar 2016 00:41:06 +0000 (UTC) Received: (qmail 14535 invoked by uid 500); 23 Mar 2016 00:41:06 -0000 Delivered-To: apmail-drill-dev-archive@drill.apache.org Received: (qmail 14483 invoked by uid 500); 23 Mar 2016 00:41:06 -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 14464 invoked by uid 99); 23 Mar 2016 00:41:06 -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; Wed, 23 Mar 2016 00:41:06 +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 B63B81A45CF for ; Wed, 23 Mar 2016 00:41:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.28 X-Spam-Level: * X-Spam-Status: No, score=1.28 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=dremio-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id cGswMhRqzgyR for ; Wed, 23 Mar 2016 00:41:02 +0000 (UTC) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id A90BD5F245 for ; Wed, 23 Mar 2016 00:41:01 +0000 (UTC) Received: by mail-lb0-f173.google.com with SMTP id k12so302138lbb.1 for ; Tue, 22 Mar 2016 17:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dremio-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=SKMioTtAa6Ti6MMTSYrQhw5+KBe6hF0KSmDcP9KYZVg=; b=YuTSXCwcSAhOWrOzVbvCWgepqzPVsOqbkgHXUcFWq2lRg+qVpF4T30tyYYWQKLcBvF nIpyh1SLOrXGGKc2jEMvRJEXWzH24+XIhIF3imEbiitMaYi5ic5WxwRC5/rIRt4F1WeF ebxRg4YThvDGRz6tGIY4iTsk4OVpb7FjfGRcxvIRhpkt6Zmlk9W58poNdPvym2CeNTYM SbsXgvGRCFfezYy8PfW3qCJjVdybf44Yk/sIUtwX3kbpKo1+HAvUz5+tHlddYp01b3v5 dtSiGftyFsKDHUvvK54DW3xxM6VkMEE4OvCib4PicPTNKnXQDCPpjydXdD5mCFjol+0h Tq7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=SKMioTtAa6Ti6MMTSYrQhw5+KBe6hF0KSmDcP9KYZVg=; b=I+eb5xNraucRjrc71y+zPPm/cFn8eZcbHskccxlMyoplxUlwcnGSRGf8liR8fhe26z IBbz7yWHCy/QHL1zTybMUE/xAucV8MSQmH2z4pmdsg9ig6nrlxWewxVnraRKh4YD/k97 n3GvdeS3PID6/JCecgxUPCqDkmi4uLxx6JKe1NGxEnzNVx/d/nNSAEixnXl7HKnvsx9u HaxKUc8Ye27MoRtSBdPnVCyHPNGBfobMDDVoESrNbYSWtdn5MpWheu7znGZ7UQ90M/MB XzpMjtVChi2ggZNglOfisnd9lLKXV3zO99nevteX2606fo7cWrUx31tvDO2E9gSCcAoA iFiQ== X-Gm-Message-State: AD7BkJIvdncmAD1xhVb9Md4OLJLj8T9hkicjEqEIehzuGz4P15hTHn7G8MkyxrRwZ6N5NeIftbAGXt6dbyFWng== MIME-Version: 1.0 X-Received: by 10.112.55.200 with SMTP id u8mr13901lbp.51.1458693660074; Tue, 22 Mar 2016 17:41:00 -0700 (PDT) Received: by 10.25.216.8 with HTTP; Tue, 22 Mar 2016 17:40:59 -0700 (PDT) In-Reply-To: References: Date: Tue, 22 Mar 2016 17:40:59 -0700 Message-ID: Subject: Re: [DISCUSS] Remove required type From: Jacques Nadeau To: dev Content-Type: multipart/alternative; boundary=001a1133bad071fa6a052eac958d --001a1133bad071fa6a052eac958d Content-Type: text/plain; charset=UTF-8 Re Performance: I think the main question is what portion of people's data is actually marked as non-nullable in Parquet files? (We already treat json, avro, kudu, and hbase (except row key) as nullable. We do treat csv as non-nullable (array) but I think these workloads start with conversion to Parquet.) Early on, we typically benchmarked Drill using required fields in Parquet. At the time, we actually hacked the Pig code to get something to even generate this format. (I believe, to this day, Pig only generates nullable fields in Parquet.) After some time, we recognized that basically every tool was producing Parquet files that were nullable and ultimately moved the benchmark infrastructure to using nullable types to do a better job of representing real-world workloads. Based on my (fuzzy) recollection, working with nullable types had a 10-15% performance impact versus working on required types so I think there is a performance impact but I think the population of users who have non-nullable Parquet files are small. If I recall, I believe Impala also creates nullable Parquet files. Not sure what Spark does. I believe Hive has also made this change recently or is doing it (deprecating non-nulls in their internals). If we move forward with this, I would expect there initially would be a decrease in performance when data is held as non-nullable given we previously observed this. However, I believe the reduction in code complexity would leads us to improve other things more quickly. Which leads me to... Re: Why Drill suffers from code complexity. This hurts forward progress. One example is the fact that we have to generate all nullable permutations of functions. (For example, if we have three arguments, we have to generate 8 separate functions to work with the combination of argument nullabilities). This leads to vastly more reliance on compile-time templating which is a maintenance headache. Additionally, it makes the runtime code generation more complicated and error prone. Testing is also more expensive because we now have twice as many paths to both validate and maintain. Realistically, we should try to move to more columnar algorithms, which would provide a bigger lift than this declared schema nullability optimization. This is because many workloads have rare nulls so we can actually optimize better at the batch level. Creating three code paths (nullable observed non-null, nullable observed null and non-null) make this substantially more complicated. We want to invest in this area but the code complexity of nullable versus required makes this tasks less likely to happen/harder. So, in essence, I'm arguing that it is a small short-term loss that leads to better code quality and ultimately faster performance. Do others have real-world observations on the frequency of required fields in Parquet files? thanks, Jacques -- Jacques Nadeau CTO and Co-Founder, Dremio On Tue, Mar 22, 2016 at 3:08 PM, Parth Chandra wrote: > I'm not entirely convinced that this would have no performance impact. Do > we have any experiments? > > > On Tue, Mar 22, 2016 at 1:36 PM, Jacques Nadeau > wrote: > > > My suggestion is we use explicit observation at the batch level. If there > > are no nulls we can optimize this batch. This would ultimately improve > over > > our current situation where most parquet and all json data is nullable so > > we don't optimize. I'd estimate that the vast majority of Drills > workloads > > are marked nullable whether they are or not. So what we're really > > suggesting is deleting a bunch of code which is rarely in the execution > > path. > > On Mar 22, 2016 1:22 PM, "Aman Sinha" wrote: > > > > > I was thinking about it more after sending the previous concerns. > Agree, > > > this is an execution side change...but some details need to be worked > > out. > > > If the planner indicates to the executor that a column is non-nullable > > (e.g > > > a primary key), the run-time generated code is more efficient since it > > > does not have to check the null bit. Are you thinking we would use the > > > existing nullable vector and add some additional metadata (at a record > > > batch level rather than record level) to indicate non-nullability ? > > > > > > > > > On Tue, Mar 22, 2016 at 12:27 PM, Jacques Nadeau > > > wrote: > > > > > > > Hey Aman, I believe both Steven and I were only suggesting removal > only > > > > from execution, not planning. It seems like your concerns are all > > related > > > > to planning. Iit seems like the real tradeoffs in execution are > > nominal. > > > > On Mar 22, 2016 9:03 AM, "Aman Sinha" wrote: > > > > > > > > > While it is true that there is code complexity due to the required > > > type, > > > > > what would we be trading off ? some important considerations: > > > > > - We don't currently have null count statistics which would need > to > > > be > > > > > implemented for various data sources > > > > > - Primary keys in the RDBMS sources (or rowkeys in hbase) are > > always > > > > > non-null, and although today we may not be doing optimizations to > > > > leverage > > > > > that, one could easily add a rule that converts WHERE primary_key > > IS > > > > NULL > > > > > to a FALSE filter. > > > > > > > > > > > > > > > On Tue, Mar 22, 2016 at 7:31 AM, Dave Oshinsky < > > > doshinsky@commvault.com> > > > > > wrote: > > > > > > > > > > > Hi Jacques, > > > > > > Marginally related to this, I made a small change in PR-372 > > > > (DRILL-4184) > > > > > > to support variable widths for decimal quantities in Parquet. I > > > found > > > > > the > > > > > > (decimal) vectoring code to be very difficult to understand > > (probably > > > > > > because it's overly complex, but also because I'm new to Drill > code > > > in > > > > > > general), so I made a small, surgical change in my pull request > to > > > > > support > > > > > > keeping track of variable widths (lengths) and null booleans > within > > > the > > > > > > existing fixed width decimal vectoring scheme. Can my changes be > > > > > > reviewed/accepted, and then we discuss how to fix properly > > long-term? > > > > > > > > > > > > Thanks, > > > > > > Dave Oshinsky > > > > > > > > > > > > -----Original Message----- > > > > > > From: Jacques Nadeau [mailto:jacques@dremio.com] > > > > > > Sent: Monday, March 21, 2016 11:43 PM > > > > > > To: dev > > > > > > Subject: Re: [DISCUSS] Remove required type > > > > > > > > > > > > Definitely in support of this. The required type is a huge > > > maintenance > > > > > and > > > > > > code complexity nightmare that provides little to no benefit. As > > you > > > > > point > > > > > > out, we can do better performance optimizations though null count > > > > > > observation since most sources are nullable anyway. > > > > > > On Mar 21, 2016 7:41 PM, "Steven Phillips" > > > wrote: > > > > > > > > > > > > > I have been thinking about this for a while now, and I feel it > > > would > > > > > > > be a good idea to remove the Required vector types from Drill, > > and > > > > > > > only use the Nullable version of vectors. I think this will > > greatly > > > > > > simplify the code. > > > > > > > It will also simplify the creation of UDFs. As is, if a > function > > > has > > > > > > > custom null handling (i.e. INTERNAL), the function has to be > > > > > > > separately implemented for each permutation of nullability of > the > > > > > > > inputs. But if drill data types are always nullable, this > > wouldn't > > > > be a > > > > > > problem. > > > > > > > > > > > > > > I don't think there would be much impact on performance. In > > > practice, > > > > > > > I think the required type is used very rarely. And there are > > other > > > > > > > ways we can optimize for when a column is known to have no > nulls. > > > > > > > > > > > > > > Thoughts? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ***************************Legal > > > Disclaimer*************************** > > > > > > "This communication may contain confidential and privileged > > material > > > > for > > > > > > the > > > > > > sole use of the intended recipient. Any unauthorized review, use > or > > > > > > distribution > > > > > > by others is strictly prohibited. If you have received the > message > > by > > > > > > mistake, > > > > > > please advise the sender by reply email and delete the message. > > Thank > > > > > you." > > > > > > > > > ********************************************************************** > > > > > > > > > > > > > > > --001a1133bad071fa6a052eac958d--