本文整理汇总了Java中com.gemstone.gemfire.cache.query.TypeMismatchException类的典型用法代码示例。如果您正苦于以下问题:Java TypeMismatchException类的具体用法?Java TypeMismatchException怎么用?Java TypeMismatchException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeMismatchException类属于com.gemstone.gemfire.cache.query包,在下文中一共展示了TypeMismatchException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: minus
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
/**
*
* @param obj
* @return Object
* @throws TypeMismatchException
*/
private Object minus(Object obj)
throws TypeMismatchException {
if (obj instanceof Number){
if (obj instanceof Integer)
return Integer.valueOf(((Integer)obj).intValue()* -1);
if (obj instanceof Long)
return Long.valueOf(((Long)obj).longValue()* -1);
if (obj instanceof Double)
return Double.valueOf(((Double)obj).doubleValue()* -1);
if (obj instanceof Float)
return Float.valueOf(((Float)obj).floatValue()* -1);
if (obj instanceof Byte)
return Byte.valueOf((byte)(((Byte)obj).byteValue()* -1));
if (obj instanceof Short)
return Short.valueOf((short)(((Short)obj).shortValue()* -1));
}else if (obj == null || obj == QueryService.UNDEFINED)
return QueryService.UNDEFINED;
throw new TypeMismatchException(LocalizedStrings.CompiledUnaryMinus_0_CANNOT_BE_UNARY_MINUS.toLocalizedString(obj.getClass()));
}
示例2: getSizeEstimate
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
public int getSizeEstimate(ExecutionContext context)
throws FunctionDomainException, TypeMismatchException,
NameResolutionException, QueryInvocationTargetException
{
IndexInfo[] idxInfo = getIndexInfo(context);
if (idxInfo == null) {
// Asif: This implies it is an independent condition. So evaluate it first
// in filter operand
return 0;
}
assert idxInfo.length == 1;
Object key = idxInfo[0].evaluateIndexKey(context);
if (key != null && key.equals(QueryService.UNDEFINED))
return 0;
// if the key is the LEFT operand, then reflect the operator
// before the index lookup
int op = reflectOnOperator(idxInfo[0]._key());
return idxInfo[0]._index.getSizeEstimate(key, op, idxInfo[0]._matchLevel);
}
示例3: evaluateSortCriteria
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
/**
* Yogesh : This methods evaluates sort criteria and returns a ArrayList of
* Object[] arrays of evaluated criteria
* @param context
* @param sr
* @return ArrayList
* @throws FunctionDomainException
* @throws TypeMismatchException
* @throws NameResolutionException
* @throws QueryInvocationTargetException
*/
private ArrayList evaluateSortCriteria(ExecutionContext context, Object sr)
throws FunctionDomainException, TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
CompiledSortCriterion csc ;
ArrayList list = new ArrayList();
if(orderByAttrs != null){
Iterator orderiter = orderByAttrs.iterator();
while (orderiter.hasNext()) {
csc = (CompiledSortCriterion)orderiter.next();
Object[] arr = new Object[2];
arr[0] = csc.evaluate(context);
arr[1] = Boolean.valueOf(csc.criterion);
list.add(arr);
}
}
return list;
}
示例4: executeQuery
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
/**
* Asif: This method should not be used for multiple partitioned regions based join queries
* We do not support equijoin queries on PartitionedRegions unless they are colocated
* and the the colocated columns ACTUALLY EXIST IN WHERE CLAUSE , AND IN CASE OF
* MULTI COLUMN PARTITIONING , SHOULD HAVE AND CLAUSE.
*
* If not , this method will return wrong results. We DO NOT DETECT COLOCATION
* CRITERIA IN THE MULTI REGION PR BASED QUERIES.
*/
public Object executeQuery(DefaultQuery query, Object[] parameters,
Set buckets) throws FunctionDomainException,
TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
long startTime = 0L;
Object result = null;
boolean traceOn = DefaultQuery.QUERY_VERBOSE || query.isTraced();
if (traceOn && this.proxy != null) {
startTime = NanoTimer.getTime();
}
QueryObserver indexObserver = query.startTrace();
try{
result = this.proxy.executeQuery(query, parameters, getBucketSet());
}
finally {
query.endTrace(indexObserver, startTime, result);
}
return result;
}
示例5: directGetData
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
private void directGetData() throws SQLException,
NameResolutionException, TypeMismatchException, FunctionDomainException,
QueryInvocationTargetException {
switch(this.queryAPI) {
case QueryPrms.GFE_GFK:
case QueryPrms.GFE_GFK_DVD:
case QueryPrms.GFE:
getDataFromRegion();
break;
case QueryPrms.MYSQL:
case QueryPrms.MYSQLC:
case QueryPrms.ORACLE:
case QueryPrms.GPDB:
case QueryPrms.GFXD:
preparedQueryQueryData();
break;
case QueryPrms.RTE:
preparedQueryQueryData();
break;
default:
unsupported();
}
}
示例6: isBetterFilter
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
public boolean isBetterFilter(Filter comparedTo, ExecutionContext context, int thisSize) throws FunctionDomainException, TypeMismatchException, NameResolutionException, QueryInvocationTargetException
{
//If the current filter is equality & comparedTo filter is also equality based , then
// return the one with lower size estimate is better
boolean isThisBetter = true;
int thatOperator = comparedTo.getOperator() ;
switch(thatOperator) {
case TOK_EQ:
isThisBetter = false;
break;
case TOK_NE:
case TOK_NE_ALT:
//Give preference to Range
break;
default :
throw new IllegalArgumentException("The operator type ="+ thatOperator + " is unknown");
}
return isThisBetter;
}
示例7: preparedOQLQueryQueryData
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
private void preparedOQLQueryQueryData(int i, int queryType, Query query)
throws NameResolutionException, TypeMismatchException,
FunctionDomainException, QueryInvocationTargetException {
Object rs = null;
long start = this.querystats.startQuery();
switch (this.queryAPI) {
case QueryPrms.OQL:
rs =
((OQLQueryFactory) this.queryFactory)
.fillAndExecutePreparedQueryStatement(query, queryType, i);
((OQLQueryFactory) this.queryFactory).readResultSet(queryType, rs);
break;
default:
String s = "Unsupported API: " + QueryPrms.getAPIString(this.queryAPI);
throw new HydraConfigException(s);
}
this.querystats.endQuery(start, this.histogram);//, this.isMainWorkload);
//rs.close();
}
示例8: evaluate
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
public Object evaluate(ExecutionContext context, Object evaluatedPath) throws FunctionDomainException, TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
Iterator itr = this.notEqualTypeKeys.iterator();
while(itr.hasNext()) {
Object val = itr.next();
Object result = TypeUtils.compare(evaluatedPath, val, TOK_NE);
if( result instanceof Boolean) {
if( !((Boolean)result).booleanValue()) {
return Boolean.FALSE;
}
}else {
throw new TypeMismatchException("NotEqualConditionEvaluator should evaluate to boolean type");
}
}
return Boolean.TRUE;
}
示例9: protGetPlanInfo
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
@Override
protected PlanInfo protGetPlanInfo(ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException, NameResolutionException {
PlanInfo result = new PlanInfo();
IndexInfo[] indexInfo = getIndexInfo(context);
if (indexInfo == null) return result;
for (int i = 0; i < indexInfo.length; ++i) {
result.indexes.add(indexInfo[i]._index);
}
result.evalAsFilter = true;
String preferredCondn = (String)context.cacheGet(PREF_INDEX_COND);
if(preferredCondn != null) {
//This means that the system is having only one independent iterator so equi join is ruled out.
// thus the first index is guaranteed to be on the condition which may match our preferred index
if(indexInfo[0]._index.getCanonicalizedIndexedExpression().equals(preferredCondn) &&
indexInfo[0]._index.getType() != IndexType.PRIMARY_KEY) {
result.isPreferred = true;
}
}
return result;
}
示例10: getPathAndKey
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
/**
* get the path to see if there's an index for, and also determine which
* CompiledValue is the key while we're at it
*/
private PathAndKey getPathAndKey(ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException {
// RuntimeIterator lIter = context.findRuntimeIterator(_left);
// RuntimeIterator rIter = context.findRuntimeIterator(_right);
boolean isLeftDependent = context.isDependentOnCurrentScope(_left);
boolean isRightDependent = context.isDependentOnCurrentScope(_right);
if ((isLeftDependent == false) == (isRightDependent == false)) return null;
CompiledValue indexKey;
CompiledValue path;
if (isLeftDependent == false) {
path = _right;
indexKey = _left;
}
else {
path = _left;
indexKey = _right;
}
if (indexKey.isDependentOnCurrentScope(context)) return null; // this check
// seems to be
// redunant.
return new PathAndKey(path, indexKey);
}
示例11: generateSingleCondnEvaluatorIfRequired
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
/**
* Creates a Filter of type SingleCondnEvaluator if there exists atleast one
* key of type "NOT EQUAL" which satisfies the 'less' or 'greater' type
* operand. Otherwise the Filter is nothing but the CompiledComparison
* representing the 'less' or 'greater' inequality
*
* @param notEqualKeys
* Set containing NotEqual type Keys
* @param operand
* CompiledValue representing the 'Less' or 'Greater' operand
* @param operator
* Type of 'Less' or 'Greater' operand
* @param condnKey
* The Key corresponding to the Operand representing the 'Less'
* or 'Greater' inequality
* @param indxInfo
* The IndexInfo object for this RangeJunction
* @return Filter object of type CompiledComparison or
* RangeJunction.SingleCondnEvaluator object
* @throws TypeMismatchException
*/
private Filter generateSingleCondnEvaluatorIfRequired(Set notEqualKeys,
CompiledValue operand, int operator, Object condnKey, IndexInfo indxInfo)
throws TypeMismatchException {
Filter rangeFilter;
if (notEqualKeys != null) {
// Eliminate all the not equal keys which will never be satisfied by
// the given greater condn
Iterator itr = notEqualKeys.iterator();
while (itr.hasNext()) {
Object neKey = itr.next();
if (!((Boolean)TypeUtils.compare(neKey, condnKey, operator))
.booleanValue()) {
itr.remove();
}
}
if (notEqualKeys.isEmpty()) {
notEqualKeys = null;
}
}
rangeFilter = (notEqualKeys != null) ? new SingleCondnEvaluator(operator,
condnKey, notEqualKeys, indxInfo) : (Filter)operand;
return rangeFilter;
}
示例12: protGetPlanInfo
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
protected PlanInfo protGetPlanInfo(ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException, NameResolutionException {
PlanInfo result = new PlanInfo();
IndexInfo[] indexInfo = getIndexInfo(context);
if (indexInfo == null) return result;
for (int i = 0; i < indexInfo.length; ++i) {
result.indexes.add(indexInfo[i]._index);
}
result.evalAsFilter = true;
String preferredCondn = (String)context.cacheGet(PREF_INDEX_COND);
if(preferredCondn != null) {
//This means that the system is having only one independent iterator so equi join is ruled out.
// thus the first index is guaranteed to be on the condition which may match our preferred index
if(indexInfo[0]._index.getCanonicalizedIndexedExpression().equals(preferredCondn) &&
(indexInfo[0]._index.getType() == IndexType.FUNCTIONAL || indexInfo[0]._index.getType() == IndexType.HASH)) {
result.isPreferred = true;
}
}
return result;
}
示例13: evaluateIndexIteratorsFromRE
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
/**
* Returns evaluated collection for dependent runtime iterator for this index
* from clause and given RegionEntry.
*
* @param context passed here is query context.
* @return Evaluated second level collection.
* @throws QueryInvocationTargetException
* @throws NameResolutionException
* @throws TypeMismatchException
* @throws FunctionDomainException
*/
protected List evaluateIndexIteratorsFromRE(Object value, ExecutionContext context)
throws FunctionDomainException,
TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
//We need NonTxEntry to call getValue() on it. RegionEntry does
//NOT have public getValue() method.
if (value instanceof RegionEntry) {
value = ((LocalRegion) this.getRegion()).new NonTXEntry(
(RegionEntry) value);
}
// Get all Independent and dependent iterators for this Index.
List itrs = getAllDependentRuntimeIterators(context);
List values = evaluateLastColl(value, context, itrs, 0);
return values;
}
示例14: hasNext
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
public boolean hasNext() {
if (iterator.hasNext()) {
IndexMap.IndexEntry indexEntry = iterator.next();
nextEntry.setIndexEntry(indexEntry);
needToCallHasNext = false;
if (keysToRemove != null) {
Iterator keysToRemoveIterator = keysToRemove.iterator();
while (keysToRemoveIterator.hasNext()) {
try {
if (TypeUtils
.compare(nextEntry.getDeserializedValue(), keysToRemoveIterator.next(), OQLLexerTokenTypes.TOK_EQ).equals(
Boolean.TRUE)) {
return hasNext();
}
} catch (TypeMismatchException e) {
// they are not equals, so we just continue iterating
}
}
}
return true;
}
return false;
}
示例15: executeQueryPreparedStatement
import com.gemstone.gemfire.cache.query.TypeMismatchException; //导入依赖的package包/类
public Object executeQueryPreparedStatement(Query pstmt, Object[] params)
throws NameResolutionException, TypeMismatchException,
FunctionDomainException, QueryInvocationTargetException {
if (QueryPrms.logQueries()) {
Log.getLogWriter().info("Executing query: " + pstmt.getQueryString());
}
//Collection rs = new ArrayList();
Object rs = pstmt.execute(params);
/*
if (value instanceof Collection) {
rs.addAll((Collection)value);
}
else {
rs.add(value);
}
*/
if (QueryPrms.logQueries()) {
Log.getLogWriter().info("Executed query: " + pstmt);
}
return rs;
}