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 9B8E218668 for ; Fri, 9 Oct 2015 14:03:45 +0000 (UTC) Received: (qmail 72287 invoked by uid 500); 9 Oct 2015 14:03:45 -0000 Delivered-To: apmail-drill-dev-archive@drill.apache.org Received: (qmail 72236 invoked by uid 500); 9 Oct 2015 14:03:45 -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 72219 invoked by uid 99); 9 Oct 2015 14:03:45 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Oct 2015 14:03:45 +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 B12CE1A07C0 for ; Fri, 9 Oct 2015 14:03:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.281 X-Spam-Level: *** X-Spam-Status: No, score=3.281 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 4LhKrg9qfynm for ; Fri, 9 Oct 2015 14:03:43 +0000 (UTC) Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id A1F0A2164D for ; Fri, 9 Oct 2015 14:03:42 +0000 (UTC) Received: by wiclk2 with SMTP id lk2so72125654wic.0 for ; Fri, 09 Oct 2015 07:03:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=1QzBAtNJL0RUEGIK9N9FU3Dx+SOipnO+86xmNDjvbZU=; b=fVrUb8vNXd+L2clN90Sh9P3oGApmzBbioxQze21oLOlPG/kmt+dQ9PE43oOOwJItqE kHWd2EFLvwSYNMi37l7tYICNY+wl2/p6MTlpP/6FnJMjrt1DoPgBvD75pzP3zAec9Raz h2fEIZZs4DcgEkJPoyd3CAgaQdnfIaEo9XC6gcVcIDXCBxRJgBVydfu1aw7ufV+fRphT 3HINwrd8TGH4NPLXlIAP95eCvH8ZvcbGsr6yEPaiFWIJBqb6AUM9Pei+oA6o8yReKu7m yDazwSxeonIuRM5u7k0XlpskcZqN8FYllFexRlx2MLBfZKlMODDXN1FewmaolaXOHP9O pmaQ== X-Gm-Message-State: ALoCoQn8OnQSCgHkTck4CX6NtL0wuSSm5zJQYaZI79tviXJPKxpm8g40ONR0Y3UvhI3JI1bIZPJC MIME-Version: 1.0 X-Received: by 10.194.63.81 with SMTP id e17mr4523947wjs.147.1444399414865; Fri, 09 Oct 2015 07:03:34 -0700 (PDT) Received: by 10.27.101.10 with HTTP; Fri, 9 Oct 2015 07:03:34 -0700 (PDT) Date: Fri, 9 Oct 2015 07:03:34 -0700 Message-ID: Subject: Improvements to storage plugin planning integration support From: Jacques Nadeau To: dev@drill.apache.org, Julian Hyde , Maryann Xue , James Taylor Content-Type: multipart/alternative; boundary=047d7b86db76099cc30521ac7242 --047d7b86db76099cc30521ac7242 Content-Type: text/plain; charset=UTF-8 A number of us were meeting last week to work through integrating the Phoenix storage plugin. This plugin is interesting because it also uses Calcite for planning. In some ways, this should make integration easy. However, it also allowed us to see certain constraints who how we expose planner integration between storage plugins and Drill internals. Currently, Drill asks the plugin to provide a set of optimizer rules which it incorporates into one of the many stages of planning. This is too constraining in two ways: 1. it doesn't allow a plugin to decide which phase of planning to integrate with. (This was definitely a problem in the Phoenix case. Our hack solution for now is to incorporate storage plugin rules in phases instead of just one [1].) 2. it doesn't allow arbitrary transformations. Calcite provides a program concept. It may be that a plugin needs to do some of its own work using the Hep planner. Currently there isn't an elegant way to do this in the context of the rule. 3. There is no easy way to incorporate additional planner initialization options. This was almost a problem in the case of the JDBC plugin. It turned out that a hidden integration using register() here [2] allowed us to continue throughout the planning phases. However, we have to register all the rules for all the phases of planning which is a bit unclean. We're hitting the same problem in the case of Phoenix where we need to register materialized views as part of planner initialization but the hack from the JDBC case won't really work. I suggest we update the interface to allow better support for these types of integrations. These seem to be the main requirements: 1. Expose concrete planning phases to storage plugins 2. Allow a storage plugin to provide additional planner initialization behavior 3. Allow a storage plugin to provide rules to include a particular planning phase (merged with other rules during that phase). 4. (possibly) allow a storage plugin to provide transformation programs that are to be executed in between the concrete planning phases. Item (4) above is the most questionable to me as I wonder whether or not this could simply be solved by creating a transformation rule (or program rule in Calcite's terminology) that creates an alternative tree and thus be solved by (3). A simple solution might be (if we ignore #4): PlannerIntegration StoragePlugin.getPlannerIntegrations() interface PlannerIntegration{ void initialize(Planner, Phase) } This way, a storage plugin could register rules (or materialized views) at setup time. What do others think? [1] https://github.com/apache/drill/blob/master/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcStoragePlugin.java#L145 [2] https://github.com/jacques-n/drill/commit/d463f9098ef63b9a2844206950334cb16fc00327#diff-e67ba82ec2fbb8bc15eed30ec6a5379cR119 -- Jacques Nadeau CTO and Co-Founder, Dremio --047d7b86db76099cc30521ac7242--