1 package com.daffodilwoods.daffodildb.server.sql99.dql.execution; 2 3 import com.daffodilwoods.daffodildb.server.serversystem.*; 4 import com.daffodilwoods.daffodildb.server.sql99.common.*; 5 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.condition.*; 6 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.table.*; 7 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.predicates.*; 8 import com.daffodilwoods.daffodildb.server.sql99.expression.rowvalueexpression.*; 9 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 10 import com.daffodilwoods.daffodildb.utils.comparator.*; 11 import com.daffodilwoods.database.resource.*; 12 import com.daffodilwoods.database.sqlinitiator.*; 13 14 27 28 public class RightIndexed extends PredicateAbstract implements predicate, OperatorConstants, _ComparisonPredicate { 29 30 34 35 comparisonpredicate bve; 36 37 40 41 int Operator; 42 43 46 47 SuperComparator comparator; 48 49 public RightIndexed() { 50 } 51 52 58 59 public RightIndexed(comparisonpredicate bveArg, int OperatorArg) throws DException { 60 bve = bveArg; 61 ColumnDetails[] columnDetails1 = bve._rowvalueexpressionwithoutboolean2.getColumnDetails(); 62 ColumnDetails[] columnDetails2 = bve._valueexpressionwithoutboolean0.getColumnDetails(); 63 switch (OperatorArg) { 64 case LESSTHAN: 65 Operator = GREATERTHAN; 66 break; 67 case LESSTHANEQUALTO: 68 Operator = GREATERTHANEQUALTO; 69 break; 70 case GREATERTHAN: 71 Operator = LESSTHAN; 72 break; 73 case GREATERTHANEQUALTO: 74 Operator = LESSTHANEQUALTO; 75 break; 76 default: 77 Operator = OperatorArg; 78 } 79 } 80 81 94 95 public Object run(Object object) throws DException { 96 Object fieldBase2 = bve._rowvalueexpressionwithoutboolean2.run(object); 97 Object fieldBase1 = bve._valueexpressionwithoutboolean0.run(object); 98 99 _VariableValues variableValue = (_VariableValues) object; 100 int cmp; 101 try { 102 cmp = comparator.compare(fieldBase1, fieldBase2); 103 } catch (NullPointerException ex) { 104 ByteComparison bc1 = bve._rowvalueexpressionwithoutboolean2.getByteComparison(object); 105 ByteComparison bc2 = bve._valueexpressionwithoutboolean0.getByteComparison(object); 106 comparator = bve.getAppropriateComparator(bc1, bc2, fieldBase1, fieldBase2, null); 107 cmp = comparator.compare(fieldBase1, fieldBase2); 108 } 109 return booleanResult[Operator - 1][cmp + 2]; 110 } 111 112 116 117 public String toString() { 118 return bve.toString(); 119 } 120 121 public Object getValue() throws DException { 122 return bve.getValue(); 123 } 124 125 public int getPredicateType() throws DException { 126 return bve.getPredicateType(); 127 } 128 129 public _QualifiedBVE getQualifiedBVE(TableDetails[] tableDetails) throws DException { 130 return bve.getQualifiedBVE(tableDetails); 131 } 132 133 public double getCost(long rowCount, boolean index) throws DException { 134 return bve.getCost(rowCount, index); 135 } 136 137 public _IndexPredicateInterface getCost(_Order order, String [] queryColumns, Object session, TableDetails tableDetails) throws DException { 138 throw new UnsupportedOperationException ("Method not supported"); 139 } 140 141 public void setColumnPredicates(_AllColumnPredicates allColumnPredicates) throws DException { 142 bve.setColumnPredicates(allColumnPredicates); 143 } 144 145 public ParameterInfo[] getParameterInfo() throws DException { 146 return bve.getParameterInfo(); 147 } 148 149 public AbstractRowValueExpression[] getChilds() { 150 AbstractRowValueExpression[] childs = new AbstractRowValueExpression[] {bve}; 151 return childs; 152 } 153 154 public _Reference[] checkSemantic(_ServerSession parent) throws DException { 155 return bve.checkSemantic(parent); 156 } 157 158 public long getEstimatedRows(long noOfRows) throws DException { 159 return bve.getEstimatedRows(noOfRows); 160 } 161 162 public int canUseForSeek() throws DException { 163 return bve.canUseForSeek(); 164 } 165 166 public int getConditionType() throws com.daffodilwoods.database.resource.DException { 167 return bve.getConditionType(); 168 } 169 170 public _BVEPlan getExecutionPlan() throws com.daffodilwoods.database.resource.DException { 171 return bve.getExecutionPlan(); 172 } 173 174 public boolean isNullPredicate() throws DException { 175 return bve.isNullPredicate(); 176 } 177 178 public void setOperator(int Type) throws DException { 179 Operator = Type; 180 } 181 } 182 | Popular Tags |