Package com.foundationdb.server.types.value

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


        int latColumn = index.firstSpatialArgument();
        int lonColumn = latColumn + 1;
        // 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();
        SpatialIndexValueRecord zForwardRow = new SpatialIndexValueRecord(indexRowFields);
        SpatialIndexValueRecord zBackwardRow = new SpatialIndexValueRecord(indexRowFields);
        SpatialIndexValueRecord zMaxRow = new SpatialIndexValueRecord(indexRowFields);
        SpatialIndexValueRecord zMinRow = new SpatialIndexValueRecord(indexRowFields);
        IndexBound zForward = new IndexBound(zForwardRow, indexColumnSelector);
        IndexBound zBackward = new IndexBound(zBackwardRow, indexColumnSelector);
        IndexBound zMax = new IndexBound(zMaxRow, indexColumnSelector);
        IndexBound zMin = new IndexBound(zMinRow, indexColumnSelector);
        // Take care of any equality restrictions before the spatial fields
        zPosition = latColumn;
        for (int f = 0; f < zPosition; f++) {
            ValueSource eqValueSource = loExpressions.value(f);
            zForwardRow.value(f, eqValueSource);
            zBackwardRow.value(f, eqValueSource);
            zMaxRow.value(f, eqValueSource);
            zMinRow.value(f, eqValueSource);
        }
View Full Code Here


        if (startKey != null) {
            if (startBoundColumns == 0) {
                startKey.append(startBoundary);
            } else {
                // Check constraints on start and end
                ValueRecord loExpressions = lo.boundExpressions(context, bindings);
                ValueRecord hiExpressions = hi.boundExpressions(context, bindings);
                for (int f = 0; f < endBoundColumns - 1; f++) {
                    keyAdapter.checkConstraints(loExpressions, hiExpressions, f, null, types);
                }
                /*
                    Null bounds are slightly tricky. An index restriction is described by an IndexKeyRange which contains
                    two IndexBounds. The IndexBound wraps an index row. The fields of the row that are being restricted are
                    described by the IndexBound's ColumnSelector. The only index restrictions supported specify:
                    a) equality for zero or more fields of the index,
                    b) 0-1 inequality, and
                    c) any remaining columns unbounded.

                    By the time we get here, we've stopped paying attention to part c. Parts a and b occupy the first
                    orderingColumns columns of the index. Now about the nulls: For each field of parts a and b, we have a
                    lo value and a hi value. There are four cases:

                    - both lo and hi are non-null: Just write the field values into startKey and endKey.

                    - lo is null: Write null into the startKey.

                    - hi is null, lo is not null: This restriction says that we want everything to the right of
                      the lo value. Persistit ranks null lower than anything, so instead of writing null to endKey,
                      we write Key.AFTER.

                    - lo and hi are both null: This is NOT an unbounded case. This means that we are restricting both
                      lo and hi to be null, so write null, not Key.AFTER to endKey.
                */
                // Construct start and end keys
                ValueRecord startExpressions = start.boundExpressions(context, bindings);
                ValueRecord endExpressions = end.boundExpressions(context, bindings);
                // startBoundColumns == endBoundColumns because jump() hasn't been called.
                // If it had we'd be in reevaluateBoundaries, not here.
                assert startBoundColumns == endBoundColumns;
                S[] startValues = keyAdapter.createSourceArray(startBoundColumns);
                S[] endValues = keyAdapter.createSourceArray(endBoundColumns);
View Full Code Here

    {
        if (startBoundColumns == 0) {
            startKey.append(startBoundary);
        } else {
            // Construct start key
            ValueRecord startExpressions = start.boundExpressions(context, bindings);
            S[] startValues = keyAdapter.createSourceArray(startBoundColumns);
            for (int f = 0; f < startBoundColumns; f++) {
                startValues[f] = keyAdapter.get(startExpressions, f);
            }
            clearStart();
View Full Code Here

    {
        List<IndexKeyRange> zKeyRanges = new ArrayList<>();
        Index index = keyRange.indexRowType().index();
        IndexBound loBound = keyRange.lo();
        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);
        long[] zValues = new long[box.maxZ()];
        space.decompose(box, zValues);
        for (int i = 0; i < zValues.length; i++) {
            long z = zValues[i];
View Full Code Here

    public void initializeScanStates()
    {
        int f = 0;
        int maxSegments = (keyRange == null /* sorting */) ? Integer.MAX_VALUE : index().getAllColumns().size();
        while (f < min(startBoundColumns, maxSegments)) {
            ValueRecord lo = keyRange.lo().boundExpressions(context, bindings);
            ValueRecord hi = keyRange.hi().boundExpressions(context, bindings);
            S loSource = sortKeyAdapter.get(lo, f);
            S hiSource = sortKeyAdapter.get(hi, f);
            /*
             * An index restriction is described by an IndexKeyRange which contains
             * two IndexBounds. The IndexBound wraps an index row. The fields of the row that are being restricted are
View Full Code Here

            assert startBoundColumns == endBoundColumns;

            clear(startKey);
            clear(endKey);

            ValueRecord startExpressions = keyRange.lo().boundExpressions(context, bindings);
            ValueRecord endExpressions = keyRange.hi().boundExpressions(context, bindings);
            int f = 0;
            while (f < keyRange.boundColumns() - 1) {
                sortKeyAdapter.checkConstraints(startExpressions, endExpressions, f, null, types);
                startKey.append(sortKeyAdapter.get(startExpressions, f), typeAt(f));
                endKey.append(sortKeyAdapter.get(endExpressions, f), typeAt(f));
View Full Code Here

TOP

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

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.