From dev-return-2576-apmail-calcite-dev-archive=calcite.apache.org@calcite.apache.org Wed Feb 24 22:17:38 2016 Return-Path: X-Original-To: apmail-calcite-dev-archive@www.apache.org Delivered-To: apmail-calcite-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 5366818768 for ; Wed, 24 Feb 2016 22:17:38 +0000 (UTC) Received: (qmail 98759 invoked by uid 500); 24 Feb 2016 22:17:28 -0000 Delivered-To: apmail-calcite-dev-archive@calcite.apache.org Received: (qmail 98682 invoked by uid 500); 24 Feb 2016 22:17:28 -0000 Mailing-List: contact dev-help@calcite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@calcite.apache.org Delivered-To: mailing list dev@calcite.apache.org Received: (qmail 98669 invoked by uid 99); 24 Feb 2016 22:17:28 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Feb 2016 22:17:28 +0000 Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 5A03D1A0181 for ; Wed, 24 Feb 2016 22:17:28 +0000 (UTC) Received: by mail-wm0-f54.google.com with SMTP id g62so2982037wme.1 for ; Wed, 24 Feb 2016 14:17:28 -0800 (PST) X-Gm-Message-State: AG10YOSB+QjeRskFusscBNv3WUjuL8WllmfCUhnOWgM8e4OuaUZQODNQs2WJX0AERF2si9pttdzbgbymYu/bgA== MIME-Version: 1.0 X-Received: by 10.28.48.137 with SMTP id w131mr198114wmw.73.1456352247057; Wed, 24 Feb 2016 14:17:27 -0800 (PST) Received: by 10.194.24.169 with HTTP; Wed, 24 Feb 2016 14:17:27 -0800 (PST) In-Reply-To: References: Date: Wed, 24 Feb 2016 14:17:27 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Materialized view rewriting From: Julian Hyde To: dev@calcite.apache.org Content-Type: text/plain; charset=UTF-8 As is typical for complex pieces of code like this, the documentation is in the code (and the unit test). It's probably not what you wanted to hear, but the code mutates quite fast and so if we'd written a design doc a few months ago it would be partially inaccurate. I, Maryann Xue and Amogh Margoor are the main authors of this code. Suggest you find a relevant test case in MaterializationTest (or write a new one) and run it with trace enabled and/or in a debugger. You will see the process of matching an expression to a MV bottom up if you watch each call to UnifyRule.unify. Julian On Wed, Feb 24, 2016 at 1:40 PM, Michael Mior wrote: > Is there any documentation anywhere on how the current implementation of > query rewriting for materialized views work? Mostly I'm referring > to MaterializedViewSubstitutionVisitor. There's a lot of code to digest > with not a lot of documentation and it would be helpful to have a reference > to refer. Thanks! > > Cheers, > -- > Michael Mior > mmior@uwaterloo.ca