Package com.foundationdb.server.types

Examples of com.foundationdb.server.types.TInstance


                        "invalid comparisons: " + left + " and " + right + " against " + comparable);
            }
        }

        private TClass tClass(TPreparedExpression left) {
            TInstance type = left.resultType();
            return type == null ? null : type.typeClass();
        }
View Full Code Here


            overload = ifElseValidated;
        }
        else {
            throw new AssertionError(functionNode);
        }
         TInstance resultInstance = functionNode.getType();
         return new TPreparedFunction(overload, resultInstance, arguments, preptimeValues);
    }
View Full Code Here

    }

    private TPreparedExpression assembleCastExpression(CastExpression castExpression,
                                                       ColumnExpressionContext columnContext,
                                                       SubqueryOperatorAssembler subqueryAssembler) {
        TInstance toType = castExpression.getType();
        TPreparedExpression expr = assembleExpression(castExpression.getOperand(), columnContext, subqueryAssembler);
        if (toType == null)
            return expr;
        TInstance sourceInstance = expr.resultType();
        if (sourceInstance == null) // CAST(NULL as FOOTYPE)
        {
            toType = toType.withNullable(true);
            return new TNullExpression(toType);
        }
View Full Code Here

    private TPreparedExpression tryLiteral(ExpressionNode node) {
        TPreparedExpression result = null;
        TPreptimeValue tpv = node.getPreptimeValue();
        if (tpv != null) {
            TInstance type = tpv.type();
            ValueSource value = tpv.value();
            if (type != null && value != null)
                result = new TPreparedLiteral(type, value);
        }
        return result;
View Full Code Here

    private TPreparedExpression collate(TPreparedExpression left, Comparison comparison, TPreparedExpression right, AkCollator collator) {
        return new TComparisonExpression(left,  comparison, right, collator);
    }

    private AkCollator collator(ComparisonCondition cond, TPreparedExpression left, TPreparedExpression right) {
        TInstance leftInstance = left.resultType();
        TInstance rightInstance = right.resultType();
        TClass tClass = leftInstance.typeClass();
        assert tClass.compatibleForCompare(rightInstance.typeClass())
                : tClass + " != " + rightInstance.typeClass();
        if (tClass.underlyingType() != UnderlyingType.STRING)
            return null;
        CharacterTypeAttributes leftAttributes = StringAttribute.characterTypeAttributes(leftInstance);
        CharacterTypeAttributes rightAttributes = StringAttribute.characterTypeAttributes(rightInstance);
        return TString.mergeAkCollators(leftAttributes, rightAttributes);
View Full Code Here

    }

    @Override
    public final ValueSource uncheckedValue(int i)
    {
        TInstance type = types[i];
        PersistitKeyValueSource keySource = keyPSource(i, type);
        attach(keySource, i, type);
        return keySource;
    }
View Full Code Here

        // The index column selector needs to select all the columns before the z column, and the z column itself.
        IndexRowPrefixSelector indexColumnSelector = new IndexRowPrefixSelector(latColumn + 1);
        IndexBound loBound = keyRange.lo();
        ValueRecord loExpressions = loBound.boundExpressions(context, bindings);
        // Compute z-value at beginning of forward and backward scans
        TInstance latInstance = index.getAllColumns().get(latColumn).getColumn().getType();
        TInstance lonInstance = index.getAllColumns().get(lonColumn).getColumn().getType();
        BigDecimal lat = TBigDecimal.getWrapper(loExpressions.value(latColumn), latInstance).asBigDecimal();
        BigDecimal lon = TBigDecimal.getWrapper(loExpressions.value(lonColumn), lonInstance).asBigDecimal();
        zStart = Spatial.shuffle(space, lat.doubleValue(), lon.doubleValue());
        // Cursors going forward from starting z value (inclusive), and backward from the same z value (exclusive)
        int indexRowFields = physicalIndexRowType.nFields();
View Full Code Here

        IndexBound hiBound = keyRange.hi();
        ValueRecord loExpressions = loBound.boundExpressions(context, bindings);
        ValueRecord hiExpressions = hiBound.boundExpressions(context, bindings);
        // Only 2d, lat/lon supported for now
        double xLo, xHi, yLo, yHi;
        TInstance xinst = index.getAllColumns().get(latColumn).getColumn().getType();
        TInstance yinst = index.getAllColumns().get(lonColumn).getColumn().getType();
        xLo = TBigDecimal.getWrapper(loExpressions.value(latColumn), xinst).asBigDecimal().doubleValue();
        xHi = TBigDecimal.getWrapper(hiExpressions.value(latColumn), xinst).asBigDecimal().doubleValue();
        yLo = TBigDecimal.getWrapper(loExpressions.value(lonColumn), yinst).asBigDecimal().doubleValue();
        yHi = TBigDecimal.getWrapper(hiExpressions.value(lonColumn), yinst).asBigDecimal().doubleValue();
        SpatialObject box = BoxLatLon.newBox(xLo, xHi, yLo, yHi);
View Full Code Here

        return plan;
    }

    private Operator intersectPxPyMap(int[] keys, boolean leftOutput, boolean ascending, boolean skipScan)
    {
        TInstance intType = MNumeric.INT.instance(false);
        RowType xyValueRowType = schema.newValuesType(intType);
        List<BindableRow> keyRows = new ArrayList<>(keys.length);
        for (int key : keys) {
            List<TPreparedExpression> pExpressions =
                Arrays.<TPreparedExpression>asList(new TPreparedLiteral(intType, new Value(intType, key)));
View Full Code Here

    @Override
    public ValueSource value(int i) {
        FieldDef fieldDef = index.getAllColumns().get(i).getColumn().getFieldDef();
        int fieldPos = fieldDef.getFieldIndex();
        Object value = row.get(fieldPos);
        TInstance type = rowType.typeAt(fieldPos);
        if (DEBUG_ROWTYPE && type == null && value != null) {
            throw new RowType.InconsistentRowTypeException(i, value);
        }
        return ValueSources.valuefromObject(value, type);
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.server.types.TInstance

Copyright © 2018 www.massapicom. 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.