Package com.foundationdb.qp.exec

Examples of com.foundationdb.qp.exec.UpdatePlannable


        populateDB(GRANDPARENTS, PARENTS_PER_GRANDPARENT, CHILDREN_PER_PARENT);
        Operator scanPlan =
            filter_Default(
                groupScan_Default(group),
                Collections.singleton(parentRowType));
        final UpdatePlannable updatePlan =
            update_Default(scanPlan,
                           new UpdateFunction()
                           {
                               @Override
                               public Row evaluate(Row original, QueryContext context, QueryBindings bindings)
                               {
                                   OverlayingRow updatedRow = new OverlayingRow(original);
                                   long i = original.value(1).getInt64();
                                   updatedRow.overlay(1, i - 1000000);
                                   return updatedRow;
                               }

                               @Override
                               public boolean rowIsSelected(Row row)
                               {
                                   return true;
                               }
                           });
        long start = Long.MIN_VALUE;
        for (int s = 0; s < WARMUP_SCANS + SCANS; s++) {
            final int sFinal = s;
            long mightBeStartTime = transactionally(
                new Callable<Long>()
                {
                    @Override
                    public Long call() throws Exception
                    {
                        long start = -1L;
                        if (sFinal == WARMUP_SCANS) {
                            Tap.setEnabled(".*propagate.*", true);
                            start = System.nanoTime();
                        }
                        updatePlan.run(queryContext, queryBindings);
                        return start;
                    }
                });
            if (mightBeStartTime != -1L) {
                start = mightBeStartTime;
View Full Code Here


            limit_Default(
                filter_Default(
                    groupScan_Default(group),
                    Collections.singleton(grandparentRowType)),
                1);
        final UpdatePlannable updatePlan =
            update_Default(scanPlan,
                           new UpdateFunction()
                           {
                               @Override
                               public Row evaluate(Row original, QueryContext context, QueryBindings bindings)
                               {
                                   OverlayingRow updatedRow = new OverlayingRow(original);
                                   long i = original.value(0).getInt64();
                                   updatedRow.overlay(0, i - 1000000);
                                   return updatedRow;
                               }

                               @Override
                               public boolean rowIsSelected(Row row)
                               {
                                   return true;
                               }
                           });
        final UpdatePlannable revertPlan =
            update_Default(scanPlan,
                           new UpdateFunction()
                           {
                               @Override
                               public Row evaluate(Row original, QueryContext context, QueryBindings bindings)
                               {
                                   OverlayingRow updatedRow = new OverlayingRow(original);
                                   long i = original.value(0).getInt64();
                                   updatedRow.overlay(0, i + 1000000);
                                   return updatedRow;
                               }

                               @Override
                               public boolean rowIsSelected(Row row)
                               {
                                   return true;
                               }
                           });
        long start = Long.MIN_VALUE;
        for (int s = 0; s < WARMUP_SCANS + SCANS; s++) {
            final int sFinal = s;
            long mightBeStartTime = transactionally(
                new Callable<Long>()
                {
                    @Override
                    public Long call() throws Exception
                    {
                        long start = -1L;
                        if (sFinal == WARMUP_SCANS) {
                            Tap.setEnabled(".*propagate.*", true);
                            start = System.nanoTime();
                        }
                        updatePlan.run(queryContext, queryBindings);
                        revertPlan.run(queryContext, queryBindings);
                        return start;
                    }
                });
            if (mightBeStartTime != -1L) {
                start = mightBeStartTime;
View Full Code Here

        final int PARENTS_PER_GRANDPARENT = 10;
        final int CHILDREN_PER_PARENT = 10;
        populateDB(GRANDPARENTS, PARENTS_PER_GRANDPARENT, CHILDREN_PER_PARENT);
        // Change gid of every row of every type
        Operator scanPlan = groupScan_Default(group);
        final UpdatePlannable updatePlan =
            update_Default(scanPlan,
                           new UpdateFunction()
                           {
                               @Override
                               public Row evaluate(Row original, QueryContext context, QueryBindings bindings)
                               {
                                   OverlayingRow updatedRow = new OverlayingRow(original);
                                   long i = original.value(0).getInt64();
                                   updatedRow.overlay(0, i - 1000000);
                                   return updatedRow;
                               }

                               @Override
                               public boolean rowIsSelected(Row row)
                               {
                                   return true;
                               }
                           });
        long start = Long.MIN_VALUE;
        for (int s = 0; s < WARMUP_SCANS + SCANS; s++) {
            final int sFinal = s;
            long mightBeStartTime = transactionally(
                new Callable<Long>()
                {
                    @Override
                    public Long call() throws Exception
                    {
                        long start = -1L;
                        if (sFinal == WARMUP_SCANS) {
                            Tap.setEnabled(".*propagate.*", true);
                            start = System.nanoTime();
                        }
                        updatePlan.run(queryContext, queryBindings);
                        return start;
                    }
                });
            if (mightBeStartTime != -1L) {
                start = mightBeStartTime;
View Full Code Here

    // Inspired by bug 1020342.

    @Test
    public void test()
    {
        UpdatePlannable insertPlan =
            insert_Default(
                valuesScan_Default(
                    Arrays.asList(parentRow(1, 10)), parentRowType));
        insertPlan.run(queryContext, queryBindings);
        // Execution of insertPlan used to hang before 1020342 was fixed.
        Row[] expected = new Row[] {
            row(parentRowType, 1L, 10L),
            // Last column of child rows is generated PK value
            row(childRowType, 1L, 100L, 1L),
View Full Code Here

        Row[] rows = {
                row(customerRowType, new Object[]{0, "zzz"}),
                row(customerRowType, new Object[]{3, "jkl"}),
                row(customerRowType, new Object[]{5, "ooo"})
        };
        UpdatePlannable insertPlan = insert_Default(rowsToValueScan(rows));
        UpdateResult result = insertPlan.run(queryContext, queryBindings);
        assertEquals("rows touched", rows.length, result.rowsTouched());
        assertEquals("rows modified", rows.length, result.rowsModified());
    }
View Full Code Here

            {
                long bx = original.value(1).getInt64();
                return new OverlayingRow(original).overlay(1, -bx);
            }
        };
        UpdatePlannable updateA = update_Default(groupScan_Default(aGroup), updateAFunction);
        UpdatePlannable updateB = update_Default(groupScan_Default(bGroup), updateBFunction);
/*
        TestThread threadA = new TestThread(aGroup, updateA);
        threadA.start();
        threadA.join();
*/
 
View Full Code Here

                return new OverlayingRow(original).overlay(1, name);
            }
        };

        Operator groupScan = groupScan_Default(coi);
        UpdatePlannable updateOperator = update_Default(groupScan, updateFunction);
        UpdateResult result = updateOperator.run(queryContext, queryBindings);
        assertEquals("rows modified", 2, result.rowsModified());
        assertEquals("rows touched", db.length, result.rowsTouched());

        Cursor executable = cursor(groupScan, queryContext, queryBindings);
        Row[] expected = new Row[]{row(customerRowType, 1L, "XYZXYZ"),
View Full Code Here

                    // Make smaller to avoid Halloween (see next test).
                    return new OverlayingRow(original).overlay(0, id - 100);
                }
            };

        UpdatePlannable updateOperator = update_Default(scan, updateFunction);
        UpdateResult result = updateOperator.run(queryContext, queryBindings);
        assertEquals("rows touched", 8, result.rowsTouched());
        assertEquals("rows modified", 8, result.rowsModified());

        Cursor executable = cursor(scan, queryContext, queryBindings);
        Row[] expected = new Row[] {
View Full Code Here

            @Override
            public boolean rowIsSelected(Row row) {
                return true;
            }
        };
        UpdatePlannable insertPlan = update_Default(rowsToValueScan(rows), updateFunction);
        UpdateResult result = insertPlan.run(queryContext, queryBindings);
        assertEquals("rows touched", rows.length, result.rowsTouched());
        assertEquals("rows modified", rows.length, result.rowsModified());
    }
View Full Code Here

    private void doDelete() {
        Row[] rows = {
                row(customerRowType, new Object[]{2, "abc"})
        };
        UpdatePlannable insertPlan = delete_Default(rowsToValueScan(rows));
        UpdateResult result = insertPlan.run(queryContext, queryBindings);
        assertEquals("rows touched", rows.length, result.rowsTouched());
        assertEquals("rows modified", rows.length, result.rowsModified());
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.qp.exec.UpdatePlannable

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.