Examples of TCastResolver


Examples of com.foundationdb.server.types.service.TCastResolver

            if (keyComparable != null) {
                expression.setKeyComparable(keyComparable);
            }
            else if (TClass.comparisonNeedsCasting(leftTInst, rightTInst)) {
                boolean needCasts = true;
                TCastResolver casts = registry.getCastsResolver();
                if ( (left.getClass() == ColumnExpression.class)&& (right.getClass() == ConstantExpression.class)) {
                    // Left is a Column, right is a Constant. Ideally, we'd like to keep the Column as a Column,
                    // and not a CAST(Column AS _) -- otherwise, we can't use it in an index lookup.
                    // So, try to cast the const to the column's type. To do this, CAST(Const -> Column) must be
                    // indexFriendly, *and* casting this result back to the original Const type must equal the same
                    // const.
                    if (rightTInst == null) {
                        // literal null, so a comparison always returns UNKNOWN
                        return new BooleanConstantExpression(null);
                    }
                    if (casts.isIndexFriendly(tclass(leftTInst), tclass(rightTInst))) {
                        TInstance columnType = type(left);
                        TInstance constType = type(right);
                        TCast constToCol = casts.cast(constType, columnType);
                        if (constToCol != null) {
                            TCast colToConst = casts.cast(columnType, constType);
                            if (colToConst != null) {
                                TPreptimeValue constValue = right.getPreptimeValue();
                                ValueSource asColType = castValue(constToCol, constValue, columnType);
                                TPreptimeValue asColTypeTpv = (asColType == null)
                                        ? null
View Full Code Here

Examples of com.foundationdb.server.types.service.TCastResolver

            TInstance rTIns = rightSource.getType();
           
            if (TClass.comparisonNeedsCasting(lTIns, rTIns))
            {
                boolean nullable = leftSource.isNull() || rightSource.isNull();
                TCastResolver casts = registry.getCastsResolver();
                TInstance common = TypeResolver.commonInstance(casts, lTIns, rTIns);
                if (common == null)
                    common = typesTranslator.typeForString();
               
                Value leftCasted = new Value(common);
                Value rightCasted = new Value(common);

                TExecutionContext execContext = new TExecutionContext(Arrays.asList(lTIns, rTIns), common, qc);
                casts.cast(lTIns, common).evaluate(execContext, leftSource, leftCasted);
                casts.cast(rTIns, common).evaluate(execContext, rightSource, rightCasted);
               
                return TClass.compare(leftCasted.getType(), leftCasted,
                                      rightCasted.getType(),rightCasted)
                       == 0;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.