1 package com.daffodilwoods.daffodildb.server.sql99.fulltext.dql.condition; 2 3 import com.daffodilwoods.database.resource.DException; 4 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator._Iterator; 5 import com.daffodilwoods.database.sqlinitiator._Order; 6 import com.daffodilwoods.daffodildb.server.sql99.utils._Reference; 7 import com.daffodilwoods.daffodildb.server.sql99.common.GeneralPurposeStaticClass; 8 import com.daffodilwoods.daffodildb.utils.GetByteComparator; 9 import com.daffodilwoods.daffodildb.utils.comparator.CKpjoDpnqbsbups; 10 import com.daffodilwoods.daffodildb.utils.comparator.SuperComparator; 11 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator.set.IntersectDistinctIterator; 12 import com.daffodilwoods.daffodildb.server.sql99.common.Datatypes; 13 14 27 28 public class AllKeyWordSortedPredicate implements _FullTextPredicate { 29 32 _FullTextPredicate leftPredicate; 33 36 _FullTextPredicate rightPredicate; 37 40 String columnName; 41 _Order order; 42 43 public AllKeyWordSortedPredicate(_FullTextPredicate leftPredicate0, 44 _FullTextPredicate rightPredicate0) { 45 leftPredicate = leftPredicate0; 46 rightPredicate = rightPredicate0; 47 } 48 49 55 public int getType() throws DException { 56 return PredicateConstant.allKeyWordSortedPredicate; 57 } 58 59 65 public String getColumn() throws DException { 66 columnName = leftPredicate.getColumn(); 67 return columnName; 68 } 69 70 76 public void setColumn(String colName) throws DException { 77 leftPredicate.setColumn(colName); 78 rightPredicate.setColumn(colName); 79 } 80 81 public double getCost() throws DException { 82 return 0.0; 83 } 84 85 public double getCost(Object session) throws DException { 86 return 0.0; 87 } 88 95 public _Iterator execute(Object session) throws DException { 96 _Iterator leftIterator = leftPredicate.executeForSortedResult(session); 97 _Iterator rightIterator = rightPredicate.executeForSortedResult(session); 98 return getIntersectDistinctIterator(leftIterator, rightIterator); 99 } 100 108 private _Iterator getIntersectDistinctIterator(_Iterator leftIterator, 109 _Iterator rightIterator) throws 110 DException { 111 _Reference[] leftReferences = new _Reference[] { 112 GeneralPurposeStaticClass.getColumnDetails("documentId")}; 113 _Reference[] rightReferences = new _Reference[] { 114 GeneralPurposeStaticClass.getColumnDetails("documentId")}; 115 SuperComparator comparator = new CKpjoDpnqbsbups(new SuperComparator[] { 116 GetByteComparator.getComparator(Datatypes.LONG, true, null)}); 117 _Reference[] orderLeftColumnDetails = new _Reference[] { 118 GeneralPurposeStaticClass.getColumnDetails("documentId")}; 119 _Reference[] orderRightColumnDetails = new _Reference[] { 120 GeneralPurposeStaticClass.getColumnDetails("documentId")}; 121 return new IntersectDistinctIterator(leftIterator, rightIterator, 122 leftReferences, rightReferences, 123 comparator, orderLeftColumnDetails, 124 orderRightColumnDetails); 125 } 126 127 public double getEstimatedRow() throws DException { 128 return 1; 129 } 130 131 public void setOrder(_Order order0) throws DException { 132 this.order = order0; 133 } 134 135 public _Order getOrder() throws DException { 136 return order; 137 } 138 139 146 public _Iterator executeForSortedResult(Object indexTable) throws DException { 147 return execute(indexTable); 148 } 149 150 } 151 | Popular Tags |