1 21 22 package org.apache.derby.impl.sql.execute; 23 24 import org.apache.derby.iapi.services.loader.GeneratedMethod; 25 26 import org.apache.derby.iapi.services.monitor.Monitor; 27 28 import org.apache.derby.iapi.services.sanity.SanityManager; 29 30 import org.apache.derby.iapi.services.io.Storable; 31 32 import org.apache.derby.iapi.services.stream.HeaderPrintWriter; 33 import org.apache.derby.iapi.services.stream.InfoStreams; 34 35 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; 36 37 import org.apache.derby.iapi.error.StandardException; 38 39 40 import org.apache.derby.iapi.sql.execute.CursorResultSet; 41 import org.apache.derby.iapi.sql.execute.ExecIndexRow; 42 import org.apache.derby.iapi.sql.execute.ExecRow; 43 import org.apache.derby.iapi.sql.execute.ExecutionContext; 44 import org.apache.derby.iapi.sql.execute.NoPutResultSet; 45 46 import org.apache.derby.iapi.sql.Activation; 47 import org.apache.derby.iapi.sql.ResultSet; 48 49 import org.apache.derby.iapi.store.access.ConglomerateController; 50 import org.apache.derby.iapi.store.access.Qualifier; 51 import org.apache.derby.iapi.store.access.ScanController; 52 import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo; 53 import org.apache.derby.iapi.store.access.TransactionController; 54 55 import org.apache.derby.iapi.types.RowLocation; 56 57 import org.apache.derby.iapi.services.io.FormatableBitSet; 58 import org.apache.derby.iapi.services.io.FormatableArrayHolder; 59 import org.apache.derby.iapi.services.io.FormatableIntHolder; 60 61 import java.util.Enumeration ; 62 import java.util.Properties ; 63 import java.util.Vector ; 64 65 71 class DistinctScanResultSet extends HashScanResultSet 72 { 73 74 Enumeration element = null; 75 76 77 DistinctScanResultSet(long conglomId, 81 StaticCompiledOpenConglomInfo scoci, Activation activation, 82 GeneratedMethod resultRowAllocator, 83 int resultSetNumber, 84 int hashKeyItem, 85 String tableName, 86 String userSuppliedOptimizerOverrides, 87 String indexName, 88 boolean isConstraint, 89 int colRefItem, 90 int lockMode, 91 boolean tableLocked, 92 int isolationLevel, 93 double optimizerEstimatedRowCount, 94 double optimizerEstimatedCost) 95 throws StandardException 96 { 97 super(conglomId, scoci, activation, resultRowAllocator, resultSetNumber, 98 (GeneratedMethod) null, 0, (GeneratedMethod) null, 0, false, (Qualifier[][]) null, (Qualifier[][]) null, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOADFACTOR, DEFAULT_MAX_CAPACITY, 106 hashKeyItem, tableName, userSuppliedOptimizerOverrides, indexName, isConstraint, 107 false, colRefItem, lockMode, tableLocked, isolationLevel, 109 false, 110 optimizerEstimatedRowCount, optimizerEstimatedCost); 111 112 eliminateDuplicates = true; 114 } 115 116 120 125 public ExecRow getNextRowCore() throws StandardException 126 { 127 ExecRow result = null; 128 Object [] columns = null; 129 130 beginTime = getCurrentTimeMillis(); 131 if ( isOpen ) 132 { 133 if (firstNext) 134 { 135 element = hashtable.elements(); 136 firstNext = false; 137 } 138 139 if (element.hasMoreElements()) 140 { 141 columns = (Object []) element.nextElement(); 142 143 setCompatRow(compactRow, columns); 144 145 rowsSeen++; 146 147 result = compactRow; 148 } 149 } 151 152 currentRow = result; 153 setCurrentRow(result); 154 155 nextTime += getElapsedMillis(beginTime); 156 return result; 157 } 158 } 159 | Popular Tags |