Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 43080 invoked from network); 15 Dec 2005 22:37:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Dec 2005 22:37:13 -0000 Received: (qmail 68401 invoked by uid 500); 15 Dec 2005 22:37:12 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 68361 invoked by uid 500); 15 Dec 2005 22:37:11 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 68352 invoked by uid 99); 15 Dec 2005 22:37:11 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Dec 2005 14:37:11 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [32.97.182.145] (HELO e5.ny.us.ibm.com) (32.97.182.145) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Dec 2005 14:37:10 -0800 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e5.ny.us.ibm.com (8.12.11/8.12.11) with ESMTP id jBFManaG010384 for ; Thu, 15 Dec 2005 17:36:49 -0500 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay04.pok.ibm.com (8.12.10/NCO/VERS6.8) with ESMTP id jBFManbF088556 for ; Thu, 15 Dec 2005 17:36:49 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.12.11/8.13.3) with ESMTP id jBFManOH032279 for ; Thu, 15 Dec 2005 17:36:49 -0500 Received: from [127.0.0.1] (bandaram.svl.ibm.com [9.30.40.123]) by d01av01.pok.ibm.com (8.12.11/8.12.11) with ESMTP id jBFMampn032207 for ; Thu, 15 Dec 2005 17:36:49 -0500 Message-ID: <43A1EFA1.1080203@Sourcery.Org> Date: Thu, 15 Dec 2005 14:35:13 -0800 From: Satheesh Bandaram User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 To: derby-dev@db.apache.org Subject: Re: [jira] Updated: (DERBY-649) Useful indexes not used in UNION ALL References: <1060524664.1134627585892.JavaMail.jira@ajax.apache.org> <43A1AA79.60005@sun.com> <43A1BA2D.5050004@Sourcery.Org> <43A1D57F.6090106@debrunners.com> In-Reply-To: <43A1D57F.6090106@debrunners.com> X-Enigmail-Version: 0.85.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Some answers below... Unless you spend sometime with complex areas like optimizer, it is pretty difficult to understand what one function or a specific change is trying to do in the larger scheme of things. I do see some points here about comments that I will improve in the code. Daniel John Debrunner wrote: >I would avoid usin subjective words like 'simple', what does that >really mean? > >It's may be better to explicitly state what type of predicates are being >pushed down, rather than what isn't being pushed down. Always clearer to >state what is being done, a positive, that what is not being done, a >negative. Not sure if I read the comments as they stand, that it's >totally clear what can be pushed down. I think the code is hampered >somewhat by existing names, e.g. methods called pushExpressesion, and >then you say that expressions cannot be pushed down, but something is >being pushed down in that method! Did the original author really mean >pushPredicate or am I just confused. :-) > > PushExpression() tries to push an expression and could decide it can't, for many reasons. If a predicate qualifies some of the conditions, it would get pushed. (or copied for union case) >And even though I'm asking for more comments, in some cases one can have >too many comments. In this patch, in several places, you talk about the >type of predicates that cannot be pushed down, but it seems to me it has >no relevance to the method being commented. This confuses me, as I look >for logic matching the comments in the body of the method. Examples are: > > Method: findColumnReferenceInResult > "Handle the case of single table selects for now. Also if there >is an expression under the result column, it is not possible yet to push >the predicates for now." > I don't see any matching logic in the method. > > OK. I will cleanup comments that don't belong here. I guess I have mixed comments about what a function does and how it is used by the caller. I can separe the two. > Method: UnionNode.pushExpressions > All the comment is about what expressions can't be pushed, >but it's not decided in this method, but elsewhere. > >These "stray" comments have the problem of being very confusing some >time from now, especially if the restriction is lifted but no-one >updates the method with the stray comment as it is not required to be >modified for the fix. It' also makes other coders very nervous to change >such code, as they can't see where the restriction is being enforced, >therefore they think it's some magic they don't understand. > > > Again, the same problem as above.. mixing the use with what this function does. I think in this case, it may be useful to list what kind of predicates a unionNode can currently push and what it can't, because this is the main entry point that is specific to unions. Each type of node can only handle some specific types of predicates and it is good to list them at the entry point, though the decisions are made later. >And finally one real dumb question, in >PredicateList.pushExpressionsIntoSelect I see where you ensure the >predicate is a binary operator and has a column reference, but I can't >see where the 'don't push expressions' logic is? > > > By not calling pushExpressionsIntoSelect(), the code doesn't push expressions... Where ever I find I currently can't handle the situation, calling 'continue' in the loop skips pushing that predicate. >Also in the same method, looking at the parameter copyPredicate I was >expecting to see code that copied a predicate, but really as the comment >below says, it's re-mapping the predicate. > > We can call it remap if that makes more sense.. I would interpret remap to mean "change this predicate to point else where". That is not the case. We are creating a new predicate that matches current one with a new columnReference. So, is this copy or remap or something else? >One of my current itches is to improve general knowledge of the >optimizer, and it seems with the good work and investigation you did for >this fix, it's a great chance to ensure the resulting code with comments >is clear while it is still fresh in your mind. > >Another one of my beliefs is that correctly named methods, classes, >fields, variables etc. greatly help in understanding the code. > >Don't take this as critism, but instead just showing that code & >comments you think is somewhat obvious because you are an expert in the >area, may not appear that way to others. > > > I don't mind changing method names or variables... if you have any specific suggestion, I will consider... If I knew a better name, I would have used it already .. :-) Satheesh >Thanks, >Dan. > > > > > > > > > > > > >