Package com.foundationdb.qp.operator

Examples of com.foundationdb.qp.operator.UpdateFunction


            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);
View Full Code Here


                    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);
View Full Code Here

        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);
View Full Code Here

            @Override
            public Operator create(Schema schema) {
                RowType rowType = schema.tableRowType(tID);
                return update_Returning(
                    valuesScan_Default(bindableRows(oldRow), rowType),
                    new UpdateFunction() {
                        @Override
                        public Row evaluate(Row original, QueryContext context, QueryBindings bindings) {
                            return newRow;
                        }
View Full Code Here

    protected List<Row> updateRow(Session session, final Row oldRow, final Row newRow) {
        if(oldRow.rowType() != newRow.rowType()) {
            throw new IllegalArgumentException("mixed RowTypes");
        }
        Operator plan = API.update_Returning(API.valuesScan_Default(bindableRows(oldRow), oldRow.rowType()),
                                             new UpdateFunction()
                                             {
                                                 @Override
                                                 public Row evaluate(Row original,
                                                                     QueryContext context,
                                                                     QueryBindings bindings) {
View Full Code Here

                }
                paramIndex++;
            }
            index++;
        }
        UpdateFunction updateFunction =
                new UpsertRowUpdateFunction(Arrays.asList(updates), stream.rowType);
        stream.operator = API.update_Returning(stream.operator, updateFunction);
       
        if (logger.isDebugEnabled()) {
            ExplainContext explain = explainUpdateStatement(stream.operator, table, Arrays.asList(updates));
View Full Code Here

                assert (stream.rowType == targetRowType) : input;

            List<UpdateColumn> updateColumns = updateStatement.getUpdateColumns();
            List<TPreparedExpression> updatesP = assembleUpdates(targetRowType, updateColumns,
                    stream.fieldOffsets);
            UpdateFunction updateFunction =
                new ExpressionRowUpdateFunction(updatesP, targetRowType);

            stream.operator = API.update_Returning(stream.operator, updateFunction);
            stream.fieldOffsets = new ColumnSourceFieldOffsets (updateStatement.getTable(), targetRowType);
            if (explainContext != null)
View Full Code Here

        try {
            use(db);
        } finally {
            txnService().commitTransaction(session());
        }
        UpdateFunction updateAFunction = new UpdateFunction()
        {

            @Override
            public boolean rowIsSelected(Row row)
            {
                return row.rowType().equals(aRowType);
            }

            @Override
            public Row evaluate(Row original, QueryContext context, QueryBindings bindings)
            {
                long ax = original.value(1).getInt64();
                return new OverlayingRow(original).overlay(1, -ax);
            }
        };
        UpdateFunction updateBFunction = new UpdateFunction()
        {

            @Override
            public boolean rowIsSelected(Row row)
            {
View Full Code Here

{
    @Test
    public void basicUpdate() throws Exception {
        use(db);

        UpdateFunction updateFunction = new UpdateFunction() {

            @Override
            public boolean rowIsSelected(Row row) {
                return row.rowType().equals(customerRowType);
            }
View Full Code Here

                itemIidIndexRowType,
                Arrays.asList(itemRowType),
                InputPreservationOption.DISCARD_INPUT),
            Arrays.asList(itemRowType));
       
        UpdateFunction updateFunction = new UpdateFunction() {
                @Override
                public boolean rowIsSelected(Row row) {
                    return row.rowType().equals(itemRowType);
                }
View Full Code Here

TOP

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

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.