KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > sql > compile > OptimizableList


1 /*
2
3    Derby - Class org.apache.derby.iapi.sql.compile.OptimizableList
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.sql.compile;
23
24 import org.apache.derby.iapi.error.StandardException;
25
26 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
27
28 /**
29  * OptimizableList provides services for optimizing a list of
30  * Optimizables (tables) in a query.
31  */

32
33 public interface OptimizableList {
34
35     /**
36      * Return the number of Optimizables in the list.
37      *
38      * @return integer The number of Optimizables in the list.
39      */

40     public int size();
41
42     /**
43      * Return the nth Optimizable in the list.
44      *
45      * @param n "index" (0 based) into the list.
46      *
47      * @return Optimizable The nth Optimizables in the list.
48      */

49     public Optimizable getOptimizable(int n);
50
51     /**
52      * Set the nth Optimizable to the specified Optimizable.
53      *
54      * @param n "index" (0 based) into the list.
55      * @param optimizable New nth Optimizable.
56      */

57     public void setOptimizable(int n, Optimizable optimizable);
58
59     /**
60      * Verify that the Properties list with optimizer overrides, if specified, is valid
61      *
62      * @param dDictionary The DataDictionary to use.
63      *
64      * @exception StandardException Thrown on error
65      */

66     public void verifyProperties(DataDictionary dDictionary) throws StandardException;
67
68     /**
69      * Set the join order for this list of optimizables. The join order is
70      * represented as an array of integers - each entry in the array stands
71      * for the order of the corresponding element in the list. For example,
72      * a joinOrder of {2, 0, 1} means that the 3rd Optimizable in the list
73      * (element 2, since we are zero-based) is the first one in the join
74      * order, followed by the 1st element in the list, and finally by the
75      * 2nd element in the list.
76      *
77      * This method shuffles this OptimizableList to match the join order.
78      *
79      * Obviously, the size of the array must equal the number of elements in
80      * the array, and the values in the array must be between 0 and the
81      * number of elements in the array minus 1, and the values in the array
82      * must be unique.
83      */

84     public void reOrder(int[] joinOrder);
85
86     /**
87      * user can specify that s/he doesn't want statistics to be considered when
88      * optimizing the query.
89      */

90     public boolean useStatistics();
91
92     /**
93      * Tell whether the join order should be optimized.
94      */

95     public boolean optimizeJoinOrder();
96
97     /**
98      * Tell whether the join order is legal.
99      */

100     public boolean legalJoinOrder(int numTablesInQuery);
101
102     /**
103      * Init the access paths for these optimizables.
104      *
105      * @param optimizer The optimizer being used.
106      */

107     public void initAccessPaths(Optimizer optimizer);
108 }
109
Popular Tags