/* // $Id: //guest/julian_hyde/saffron/src/main/saffron/Planner.java#1 $ // Saffron preprocessor and data engine // Copyright (C) 2002 Julian Hyde <julian.hyde@mail.com> // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Library General Public License for more details. // // You should have received a copy of the GNU Library General Public // License along with this library; if not, write to the // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // See the COPYING file located in the top-level-directory of // the archive of this library for complete text of license. */ package saffron; import saffron.opt.Cost; import saffron.rel.Rel; /** * todo: **/ public abstract class Planner { protected Rel rel; protected static Planner current; public Planner() {} public void init(Rel rel) { this.rel = rel; } /** Negotiate an appropriate planner to deal with distributed queries. The * idea is that the schemas decide among themselves which has the most * knowledge. Right now, the local planner retains control. */ public Planner chooseDelegate() { return this; } // /** Create a plan for this query. */ // abstract Plan plan(); /** Find the most efficient expression to implement this query. */ public abstract Rel findBestExp(); /** Converts an expression to an equivalent one of a different * convention. */ public abstract Rel convert(Rel rel, int convention); /** Create a cost object. */ public abstract Cost makeCost(double dRows, double dCpu, double dIo); /** Create a cost object representing infinite cost. */ public abstract Cost makeInfiniteCost(); /** Create a cost object representing infinite cost. */ public abstract Cost makeHugeCost(); /** Create a cost object representing zero cost. */ public abstract Cost makeZeroCost(); public static final int MUST_BE_REGISTERED = 0; public static final int CHILDREN_MUST_BE_REGISTERED = 1; public static final int MAY_BE_REGISTERED = 2; /** * Register an expression in the expression bank. After it has been * registered, you may not modify it. * * @param exp expression to register * @param fail one of {@link #MUST_BE_REGISTERED}, {@link * #CHILDREN_MUST_BE_REGISTERED}, {@link #MAY_BE_REGISTERED} * @return the same expression, or an equivalent existing expression */ public abstract Rel register(Rel exp, int fail); /** Return the current planner. todo: This is a re-entrancy problem. * Maybe solve it with thread-local storage */ public static Planner current() { return current; } } // End Planner.java
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 1801 | Julian Hyde |
saffron: add ObjectSchema; rules can now be matched more than once; started to implement correlations in queries in from list. |
||
#1 | 1467 | Julian Hyde |
saffron: First saffron check-in; incorporate my changes to openjava. |