Package com.foundationdb.server.types.value

Examples of com.foundationdb.server.types.value.Value


    public void testOffsetFromBadBinding ()
    {
        Operator plan = limit_Default(groupScan_Default(coi),
                0, true, 0, false);
        Cursor cursor = cursor(plan, queryContext, queryBindings);
        queryBindings.setValue(0, new Value(MNumeric.INT.instance(false), -1));
        Row[] expected = new Row[]{};
        compareRows(expected, cursor);
    }
View Full Code Here


                null, // TODO
                ErrorHandlingMode.ERROR,
                ErrorHandlingMode.ERROR,
                ErrorHandlingMode.ERROR
        );
        Value result = new Value(targetInstance);
        try {
            cast.evaluate(context, source.value(), result);
        } catch (Exception e) {
            if (logger.isTraceEnabled()) {
                logger.trace("while casting values " + source + " to " + targetInstance + " using " + cast, e);
View Full Code Here

    private Row intRow(RowType rowType, int x)
    {
        List<TPreparedExpression> pExpressions;
        pExpressions = Arrays.asList((TPreparedExpression) new TPreparedLiteral(
                MNumeric.INT.instance(false), new Value(MNumeric.INT.instance(false), x)));
        return new ExpressionRow(rowType, queryContext, queryBindings, pExpressions);
    }
View Full Code Here

                }
                expression = defExpr;
            }
            else {
                final String defaultValue = column.getDefaultValue();
                final Value defaultValueSource;
                if(defaultValue == null) {
                    defaultValueSource = new Value(type);
                    defaultValueSource.putNull();
                } else {
                    TCast cast = type.typeClass().castFromVarchar();
                    if (cast != null) {
                        defaultValueSource = new Value(type);
                        TInstance valInst = typesTranslator.typeForString(defaultValue);
                        TExecutionContext executionContext = new TExecutionContext(Collections.singletonList(valInst),
                                                                                   type,
                                                                                   queryContext);
                        cast.evaluate(executionContext,
                                      new Value(valInst, defaultValue),
                                      defaultValueSource);
                    } else {
                        defaultValueSource = new Value(type, defaultValue);
                    }
                }
                expression = new TPreparedLiteral(type, defaultValueSource);
            }
        }
View Full Code Here

                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;
            }
            else
                return TClass.compare(lTIns, leftSource, rTIns, rightSource) == 0;
        }
View Full Code Here

            zBackwardRow.value(f, eqValueSource);
            zMaxRow.value(f, eqValueSource);
            zMinRow.value(f, eqValueSource);
        }
        // Z-value part of bounds
        Value startValue = new Value(InternalIndexTypes.LONG.instance(false));
        Value maxValue = new Value(InternalIndexTypes.LONG.instance(false));
        Value minValue = new Value(InternalIndexTypes.LONG.instance(false));
        startValue.putInt64(zStart);
        maxValue.putInt64(Long.MAX_VALUE);
        minValue.putInt64(Long.MIN_VALUE);
        zForwardRow.value(zPosition, startValue);
        zBackwardRow.value(zPosition, startValue);
        zMaxRow.value(zPosition, maxValue);
        zMinRow.value(zPosition, minValue);
        IndexKeyRange geKeyRange = IndexKeyRange.bounded(physicalIndexRowType, zForward, true, zMax, false);
View Full Code Here

                    ValueSource eqValueSource = loExpressions.value(f);
                    zLoRow.value(f, eqValueSource);
                    zHiRow.value(f, eqValueSource);
                }
                // lo and hi bounds
                Value loValue = new Value(InternalIndexTypes.LONG.instance(false));
                Value hiValue = new Value(InternalIndexTypes.LONG.instance(false));
                loValue.putInt64(Space.zLo(z));
                hiValue.putInt64(Space.zHi(z));
                zLoRow.value(latColumn, loValue);
                zHiRow.value(latColumn, hiValue);
                IndexKeyRange zKeyRange = IndexKeyRange.bounded(physicalRowType, zLo, true, zHi, true);
                zKeyRanges.add(zKeyRange);
            }
View Full Code Here

        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)));
            Row row = new ExpressionRow(xyValueRowType, queryContext, queryBindings, pExpressions);
            keyRows.add(BindableRow.of(row));
        }
        List<ExpressionGenerator> expressions = Arrays.asList(boundField(xyValueRowType, 0, 0));
        IndexBound xBound =
View Full Code Here

        try {
*/
            ValuesHolderRow row = new ValuesHolderRow(indexRowType);
            for (int i = 0; i < objs.length; i++) {
                Object obj = objs[i];
                Value value = row.valueAt(i);
                if (obj == null) {
                    value.putNull();
                } else if (obj instanceof Integer) {
                    if (ValueSources.underlyingType(value) == UnderlyingType.INT_64)
                        value.putInt64(((Integer) obj).longValue());
                    else
                        value.putInt32((Integer) obj);
                } else if (obj instanceof Long) {
                    if (ValueSources.underlyingType(value) == UnderlyingType.INT_32)
                        value.putInt32(((Long) obj).intValue());
                    else
                        value.putInt64((Long) obj);
                } else if (obj instanceof String) {
                    value.putString((String) obj, null);
                } else if (obj instanceof BigDecimal) {
                    value.putObject(new BigDecimalWrapperImpl((BigDecimal) obj));
                } else {
                    fail();
                }
            }
            return row;
View Full Code Here

                        this.limitLeft = Integer.MAX_VALUE;
                    else {
                        TInstance type = MNumeric.INT.instance(true);
                        TExecutionContext executionContext =
                            new TExecutionContext(null, type, context);
                        Value ivalue = new Value(MNumeric.INT.instance(true));
                        MNumeric.INT.fromObject(executionContext, value, ivalue);
                        this.limitLeft = ivalue.getInt32();
                    }
                }
                else {
                    this.limitLeft = limit();
                }
View Full Code Here

TOP

Related Classes of com.foundationdb.server.types.value.Value

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.