1 21 22 package org.apache.derby.impl.sql.compile; 23 24 import org.apache.derby.iapi.services.context.ContextManager; 25 26 import org.apache.derby.iapi.sql.compile.Optimizable; 27 import org.apache.derby.iapi.sql.compile.OptimizableList; 28 import org.apache.derby.iapi.sql.compile.OptimizablePredicate; 29 import org.apache.derby.iapi.sql.compile.OptimizablePredicateList; 30 import org.apache.derby.iapi.sql.compile.Optimizer; 31 import org.apache.derby.iapi.sql.compile.CostEstimate; 32 import org.apache.derby.iapi.sql.compile.Visitable; 33 import org.apache.derby.iapi.sql.compile.Visitor; 34 35 import org.apache.derby.iapi.sql.dictionary.DataDictionary; 36 37 import org.apache.derby.iapi.sql.execute.ExecutionContext; 38 39 import org.apache.derby.iapi.sql.Activation; 40 import org.apache.derby.iapi.sql.ResultColumnDescriptor; 41 import org.apache.derby.iapi.sql.ResultSet; 42 43 import org.apache.derby.iapi.error.StandardException; 44 45 import org.apache.derby.impl.sql.compile.ActivationClassBuilder; 46 47 import org.apache.derby.iapi.services.compiler.MethodBuilder; 48 49 import org.apache.derby.iapi.services.sanity.SanityManager; 50 51 import org.apache.derby.iapi.util.JBitSet; 52 53 import java.util.Properties ; 54 55 63 public class OrderByNode extends SingleChildResultSetNode 64 { 65 66 OrderByList orderByList; 67 68 77 public void init( 78 Object childResult, 79 Object orderByList, 80 Object tableProperties) 81 throws StandardException 82 { 83 ResultSetNode child = (ResultSetNode) childResult; 84 85 super.init(childResult, tableProperties); 86 87 this.orderByList = (OrderByList) orderByList; 88 89 ResultColumnList prRCList; 90 91 98 99 102 prRCList = child.getResultColumns().copyListAndObjects(); 103 resultColumns = child.getResultColumns(); 104 child.setResultColumns(prRCList); 105 106 110 resultColumns.genVirtualColumnNodes(this, prRCList); 111 } 112 113 119 120 public String toString() 121 { 122 if (SanityManager.DEBUG) 123 { 124 return childResult.toString() + "\n" + 125 "orderByList: " + 126 (orderByList != null ? orderByList.toString() : "null") + "\n" + 127 super.toString(); 128 } 129 else 130 { 131 return ""; 132 } 133 } 134 135 ResultColumnDescriptor[] makeResultDescriptors(ExecutionContext ec) 136 { 137 return childResult.makeResultDescriptors(ec); 138 } 139 140 146 public void generate(ActivationClassBuilder acb, 147 MethodBuilder mb) 148 throws StandardException 149 { 150 if (costEstimate == null) 152 { 153 costEstimate = childResult.getFinalCostEstimate(); 154 } 155 156 orderByList.generate(acb, mb, childResult); 157 } 158 } 159 | Popular Tags |