Package com.foundationdb.qp.operator

Examples of com.foundationdb.qp.operator.Cursor


                                              new SetColumnSelector(0, 1));
        IndexBound upperRight = new IndexBound(row(latLonIndexRowType, latHi, lonHi),
                                               new SetColumnSelector(0, 1));
        IndexKeyRange box = IndexKeyRange.spatial(latLonIndexRowType, lowerLeft, upperRight);
        Operator plan = indexScan_Default(latLonIndexRowType, box, lookaheadQuantum());
        Cursor cursor = API.cursor(plan, queryContext, queryBindings);
        cursor.openTopLevel();
        Row row;
        while ((row = cursor.next()) != null) {
            assertSame(latLonIndexRowType.physicalRowType(), row.rowType());
            long z = getLong(row, 0);
            Integer expectedId = zToId.get(z);
            assertNotNull(expectedId);
            int id = getLong(row, 1).intValue();
View Full Code Here


                MNumeric.INT.instance(false),
                MNumeric.INT.instance(true),
                MString.VARCHAR.instance(100, true));
       
        Operator plan = map_NestedLoops(flattenCO, product, 0, pipelineMap(), 1);
        Cursor cursor = cursor(plan, queryContext, queryBindings);
        Row[] expected = new Row[]{
            row(coaRowType, 2L, "foundation", 200L, 2L, "david", 2000L, 2L, "222 2000 st"),
            row(coaRowType, 2L, "foundation", 201L, 2L, "david", 2000L, 2L, "222 2000 st"),
            row(coaRowType, 3L, "matrix", 300L, 3L, "tom", 3000L, 3L, "333 3000 st"),
            row(coaRowType, 3L, "matrix", 300L, 3L, "tom", 3001L, 3L, "333 3001 st"),
View Full Code Here

                MNumeric.INT.instance(false),
                MNumeric.INT.instance(true),
                MString.VARCHAR.instance(100, true));
       
        Operator plan = map_NestedLoops(flattenCO, product, 0, pipelineMap(), 1);
        Cursor cursor = cursor(plan, queryContext, queryBindings);
        Row[] expected = new Row[]{
            row(coaRowType, 2L, "foundation", 200L, 2L, "david", 2000L, 2L, "222 2000 st"),
            row(coaRowType, 2L, "foundation", 201L, 2L, "david", 2000L, 2L, "222 2000 st"),
            row(coaRowType, 1L, "northbridge", 100L, 1L, "ori", 1000L, 1L, "111 1000 st"),
            row(coaRowType, 1L, "northbridge", 100L, 1L, "ori", 1001L, 1L, "111 1001 st"),
View Full Code Here

        if (resultSetMetaData != null)
            // If there are results, we need to read them all now to get the update
            // count right and have this all happen even if the caller
            // does not read all of the generated keys.
            returningRows = new SpoolCursor();
        Cursor cursor = null;
        RuntimeException runtimeException = null;
        try {
            context.initStore(getSchema());
            cursor = API.cursor(resultOperator, context, bindings);
            cursor.openTopLevel();
            Row row;
            while ((row = cursor.next()) != null) {
                updateCount++;
                if (returningRows != null) {
                    returningRows.add(row);
                }
            }
        }
        catch (RuntimeException ex) {
            runtimeException = ex;
        }
        finally {
            try {
                if (cursor != null) {
                    cursor.closeTopLevel();
                }
            }
            catch (RuntimeException ex) {
                if (runtimeException == null)
                    runtimeException = ex;
View Full Code Here

                               int bHi, boolean hiInclusive,   // upper bound
                               API.Ordering ordering,         
                               long expected[])
    {
        Operator plan = indexScan_Default(idxRowType, bounded(1, bLo, lowInclusive, bHi, hiInclusive), ordering);
        Cursor cursor = cursor(plan, queryContext, queryBindings);
        cursor.openTopLevel();
        cursor.jump(indexRow(targetId), INDEX_ROW_SELECTOR);

        Row row;
        List<Row> actualRows = new ArrayList<>();
       
        while ((row = cursor.next()) != null)
        {
            actualRows.add(row);
        }
        cursor.closeTopLevel();

             // check the list of rows
        checkRows(actualRows, expected);
    }
View Full Code Here

                       IndexKeyRange range,
                       API.Ordering ordering,         
                       long expected[])
    {
        Operator plan = indexScan_Default(idxRowType, range, ordering);
        Cursor cursor = cursor(plan, queryContext, queryBindings);
        cursor.openTopLevel();

        cursor.jump(indexRowWithId(targetId), INDEX_ROW_SELECTOR);

        Row row;
        List<Row> actualRows = new ArrayList<>();
       
        while ((row = cursor.next()) != null)
        {
            actualRows.add(row);
        }
        cursor.closeTopLevel();

        // find the row with given id
        List<Row> expectedRows = new ArrayList<>(expected.length);
        for (long val : expected)
            expectedRows.add(indexRowWithId(val));
View Full Code Here

        Operator plan =
            map_NestedLoops(
                indexScan_Default(aValueIndexRowType),
                branchLookup_Nested(rabc, aValueIndexRowType, rRowType, InputPreservationOption.DISCARD_INPUT, 0),
                0, pipelineMap(), 1);
        Cursor cursor = cursor(plan, queryContext, queryBindings);
        Row[] expected = new Row[]{
            // Each r row, and everything below it, is duplicated, because the A index refers to each r value twice.
            row(rRowType, 1L, "r1"),
            row(aRowType, 13L, 1L, "a13"),
            row(aRowType, 14L, 1L, "a14"),
View Full Code Here

                    aValueIndexRowType,
                    Collections.singleton(aRowType),
                    InputPreservationOption.DISCARD_INPUT),
                branchLookup_Nested(rabc, aRowType, rRowType, InputPreservationOption.DISCARD_INPUT, 0),
                0, pipelineMap(), 1);
        Cursor cursor = cursor(plan, queryContext, queryBindings);
        Row[] expected = new Row[]{
            // Each r row, and everything below it, is duplicated, because the A index refers to each r value twice.
            row(rRowType, 1L, "r1"),
            row(aRowType, 13L, 1L, "a13"),
            row(aRowType, 14L, 1L, "a14"),
View Full Code Here

                filter_Default(
                    groupScan_Default(rabc),
                    Collections.singleton(aRowType)),
                branchLookup_Nested(rabc, aRowType, bRowType, InputPreservationOption.DISCARD_INPUT, 0),
                0, pipelineMap(), 1);
        Cursor cursor = cursor(plan, queryContext, queryBindings);
        Row[] expected = new Row[]{
            row(bRowType, 15L, 1L, "b15"),
            row(bRowType, 16L, 1L, "b16"),
            row(bRowType, 15L, 1L, "b15"),
            row(bRowType, 16L, 1L, "b16"),
View Full Code Here

                        Collections.singleton(aRowType)),
                    branchLookup_Nested(rabc, aRowType, bRowType, InputPreservationOption.DISCARD_INPUT, 0),
                    0, pipelineMap(), 1),
                branchLookup_Nested(rabc, bRowType, cRowType, InputPreservationOption.KEEP_INPUT, 1),
                1, pipelineMap(), 1);
        Cursor cursor = cursor(plan, queryContext, queryBindings);
        Row[] expected = new Row[]{
            row(bRowType, 15L, 1L, "b15"),
            row(cRowType, 17L, 1L, "c17"),
            row(cRowType, 18L, 1L, "c18"),
            row(bRowType, 16L, 1L, "b16"),
View Full Code Here

TOP

Related Classes of com.foundationdb.qp.operator.Cursor

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.