Package com.foundationdb.qp.expression

Examples of com.foundationdb.qp.expression.IndexBound


    @Test
    public void testRestrictedIndexLookup()
    {
        Index idxOrderSalesman = orderSalesmanIndexRowType.index();
        IndexBound tom = indexBound(row(orderSalesmanIndexRowType, "tom"), columnSelector(idxOrderSalesman));
        IndexKeyRange matchTom = indexKeyRange(orderSalesmanIndexRowType, tom, true, tom, true);
        Operator indexScan = indexScan_Default(orderSalesmanIndexRowType, false, matchTom);
        Operator lookup = branchLookup_Default(indexScan,
                                                       coi,
                                                       orderSalesmanIndexRowType,
View Full Code Here


    @Test
    public void testAncestorLookupAfterIndexScan()
    {
        // Find customers associated with salesman tom
        Index idxOrderSalesman = orderSalesmanIndexRowType.index();
        IndexBound tom = indexBound(row(orderSalesmanIndexRowType, "tom"), columnSelector(idxOrderSalesman));
        IndexKeyRange matchTom = indexKeyRange(orderSalesmanIndexRowType, tom, true, tom, true);
        Operator indexScan = indexScan_Default(orderSalesmanIndexRowType, false, matchTom);
        Operator ancestorLookup = ancestorLookup_Default(indexScan,
                                                                 coi,
                                                                 orderSalesmanIndexRowType,
View Full Code Here

                true);
    }

    private IndexKeyRange xEq(long x)
    {
        IndexBound bound = new IndexBound(row(tXIndexRowType, x), new SetColumnSelector(0));
        return IndexKeyRange.bounded(tXIndexRowType, bound, true, bound, true);
    }
View Full Code Here

        return IndexKeyRange.bounded(tXIndexRowType, bound, true, bound, true);
    }

    private IndexKeyRange yEq(long y)
    {
        IndexBound bound = new IndexBound(row(tYIndexRowType, y), new SetColumnSelector(0));
        return IndexKeyRange.bounded(tYIndexRowType, bound, true, bound, true);
    }
View Full Code Here

        return IndexKeyRange.bounded(tYIndexRowType, bound, true, bound, true);
    }

    private IndexKeyRange zEq(long z)
    {
        IndexBound bound = new IndexBound(row(tZIndexRowType, z), new SetColumnSelector(0));
        return IndexKeyRange.bounded(tZIndexRowType, bound, true, bound, true);
    }
View Full Code Here

    // For use by this class

    private IndexKeyRange startAtNull(IndexRowType indexRowType, boolean loInclusive, int hi, boolean hiInclusive)
    {
        return IndexKeyRange.bounded(indexRowType,
                                     new IndexBound(row(indexRowType, new Object[]{null}), COLUMN_0),
                                     loInclusive,
                                     new IndexBound(row(indexRowType, hi), COLUMN_0),
                                     hiInclusive);
    }
View Full Code Here

    }

    private IndexKeyRange keyRange(IndexRowType indexRowType, int lo, boolean loInclusive, int hi, boolean hiInclusive)
    {
        return IndexKeyRange.bounded(indexRowType,
                                     new IndexBound(row(indexRowType, lo), COLUMN_0),
                                     loInclusive,
                                     new IndexBound(row(indexRowType, hi), COLUMN_0),
                                     hiInclusive);
    }
View Full Code Here

    }

    @Test
    public void test()
    {
        IndexBound bound = new IndexBound(row(idxRowType, 110L, 15L),
                                          new SetColumnSelector(0, 1));
        IndexKeyRange range = IndexKeyRange.bounded(idxRowType, bound, true, bound, true);
        API.Ordering ordering = new API.Ordering();
        ordering.append(ExpressionGenerators.field(idxRowType, 0), true);
        ordering.append(ExpressionGenerators.field(idxRowType, 1), true);
View Full Code Here

        Space space = index.space();
        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);
View Full Code Here

    {
        assert keyRange != null;
        CursorLifecycle.checkIdleOrActive(this);
        keyRange =
            direction == FORWARD
            ? keyRange.resetLo(new IndexBound(row, columnSelector))
            : keyRange.resetHi(new IndexBound(row, columnSelector));
        initializeCursor();
        reevaluateBoundaries(context, sortKeyAdapter);
        initializeForOpen();
        state = CursorLifecycle.CursorState.ACTIVE;
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.qp.expression.IndexBound

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.