Package com.foundationdb.qp.operator

Examples of com.foundationdb.qp.operator.StoreAdapter


            });
        }
    }

    protected List<Row> runPlanInternal(Session session, Schema schema, Operator plan) {
        StoreAdapter adapter = newStoreAdapter(session, schema);
        QueryContext context = queryContext(adapter);
        Cursor cursor = API.cursor(plan, context, context.createBindings());
        cursor.openTopLevel();
        try {
            List<Row> output = new ArrayList<>();
View Full Code Here


        try {
            while(!success) {
                to(Stage.PRE_SCAN);
                Schema schema = SchemaCache.globalSchema(getServiceHolder().getSchemaManager().getAis(session));
                Operator plan = operatorCreator.create(schema);
                StoreAdapter adapter = getServiceHolder().getStore().createAdapter(session, schema);
                QueryContext context = new SimpleQueryContext(adapter);
                QueryBindings bindings = context.createBindings();
                Cursor cursor = API.cursor(plan, context, bindings);
                cursor.openTopLevel();
                try {
View Full Code Here

        return txnService().run(session(), new Callable<List<Row>>() {
            @Override
            public List<Row> call() throws Exception {
                Schema schema = SchemaCache.globalSchema(ais());
                Operator plan = creator.create(schema);
                StoreAdapter adapter = store().createAdapter(session(), schema);
                QueryContext context = new SimpleQueryContext(adapter, serviceManager());
                QueryBindings bindings = context.createBindings();
                List<Row> rows = new ArrayList<>();
                Cursor cursor = API.cursor(plan, context, bindings);
                cursor.openTopLevel();
View Full Code Here

        try {
            stmt = parser.parseStatement(queryExpression);
        } catch (StandardException e) {
            throw new SQLParserInternalException(e);
        }
        StoreAdapter adapter = store().createAdapter(session, SchemaCache.globalSchema(ais));
        CreateAsCompiler compiler = new CreateAsCompiler(server, adapter, false, ais);
        PlanContext plan = new PlanContext(compiler);
        ASTStatementLoader astStatementLoader = new ASTStatementLoader();
        AISBinder binder = new AISBinder(ais, table.getName().getSchemaName());
        try {
View Full Code Here

                API.filter_Default(
                    API.groupScan_Default(table.getGroup()), filterTypes),
                false
            );

        StoreAdapter adapter = store.createAdapter(session, schema);
        QueryContext context = new SimpleQueryContext(adapter);
        com.foundationdb.qp.operator.Cursor cursor = API.cursor(plan, context, context.createBindings());
        cursor.openTopLevel();
        try {
            Row row;
View Full Code Here

        final TableIds tids = createTables();
        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        RowType cType = schema.tableRowType(getTable(tids.c));
        RowType oType = schema.tableRowType(getTable(tids.o));
        RowType iType = schema.tableRowType(getTable(tids.i));
        StoreAdapter adapter = newStoreAdapter(schema);

        Object[] o1Cols = { 10, 1 };
        Object[] cCols = { 2, "c2" };
        Object[] oCols = { 20, 2 };
        Object[] iCols = { 200, 20, "i200" };
        TestRow o1Row = new TestRow(oType, o1Cols);
        TestRow cRow = new TestRow(cType, cCols);
        TestRow oRow = new TestRow(oType, oCols);
        TestRow iRow = new TestRow(iType, iCols);

        // Unrelated o row, to demonstrate i ordering/adoption
        writeRow(tids.o, o1Cols);
        compareRows( new Row[] { o1Row }, adapter.newGroupCursor(cType.table().getGroup()) );

        // i is first due to null cid component
        writeRow(tids.i, iCols);
        compareRows( new Row[] { iRow, o1Row }, adapter.newGroupCursor(cType.table().getGroup()) );

        // i should get adopted by the new o, filling in it's cid component
        writeRow(tids.o, oCols);
        compareRows( new Row[] { o1Row, oRow, iRow, }, adapter.newGroupCursor(cType.table().getGroup()) );

        writeRow(tids.c, cCols);
        compareRows( new Row[] { o1Row, cRow, oRow, iRow }, adapter.newGroupCursor(cType.table().getGroup()) );
    }
View Full Code Here

        final TableIds tids = createTables();
        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        RowType cType = schema.tableRowType(getTable(tids.c));
        RowType oType = schema.tableRowType(getTable(tids.o));
        RowType iType = schema.tableRowType(getTable(tids.i));
        StoreAdapter adapter = newStoreAdapter(schema);

        Object[] o1Cols = { 10, 1 };
        Object[] cCols = { 2, "c2" };
        Object[] oCols = { 20, 2 };
        Object[] iCols = { 200, 20, "i200" };
        TestRow o1Row = new TestRow(oType, o1Cols);
        TestRow cRow = new TestRow(cType, cCols);
        TestRow oRow = new TestRow(oType, oCols);
        TestRow iRow = new TestRow(iType, iCols);

        writeRow(tids.o, o1Cols);
        writeRow(tids.c, cCols);
        writeRow(tids.o, oCols);
        writeRow(tids.i, iCols);
        compareRows( new Row[] { o1Row, cRow, oRow, iRow }, adapter.newGroupCursor(cType.table().getGroup()) );

        deleteRow(tids.c, cCols);
        compareRows( new Row[] { o1Row, oRow, iRow }, adapter.newGroupCursor(cType.table().getGroup()) );

        // Delete o => i.cid becomes null
        deleteRow(tids.o, oCols);
        compareRows( new Row[] { iRow, o1Row }, adapter.newGroupCursor(cType.table().getGroup()) );

        deleteRow(tids.i, iCols);
        compareRows( new Row[] { o1Row }, adapter.newGroupCursor(cType.table().getGroup()) );

        deleteRow(tids.o, o1Cols);
        compareRows( new Row[] { }, adapter.newGroupCursor(cType.table().getGroup()) );
    }
View Full Code Here

        final TableIds tids = createTables();
        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        RowType cType = schema.tableRowType(getTable(tids.c));
        RowType oType = schema.tableRowType(getTable(tids.o));
        RowType iType = schema.tableRowType(getTable(tids.i));
        StoreAdapter adapter = newStoreAdapter(schema);

        Object[] o1Cols = { 10, 1 };
        Object[] cCols = { 2, "c2" };
        Object[] oOrig = { 1, 1 };
        Object[] oUpdate = { 20, 2 };
        Object[] iCols = { 200, 20, "i200" };
        TestRow o1Row = new TestRow(oType, o1Cols);
        TestRow cRow = new TestRow(cType, cCols);
        TestRow oOrigRow = new TestRow(oType, oOrig);
        TestRow oUpdateRow = new TestRow(oType, oUpdate);
        TestRow iRow = new TestRow(iType, iCols);

        writeRow(tids.o, o1Cols);
        writeRow(tids.c, cCols);
        writeRow(tids.o, oOrig);
        writeRow(tids.i, iCols);
        compareRows( new Row[] { iRow, oOrigRow, o1Row, cRow }, adapter.newGroupCursor(cType.table().getGroup()) );

        // updated o moves after o1 and adopts i
    updateRow(oOrigRow, oUpdateRow);
        compareRows( new Row[] { o1Row, cRow, oUpdateRow, iRow }, adapter.newGroupCursor(cType.table().getGroup()) );
    }
View Full Code Here

        if (parts[0].isEmpty()) {
            parts[0] = context.getCurrentSchema();
        }

        TableName sequenceName = new TableName(parts[0], parts[1]);
        StoreAdapter store = context.getQueryContext().getStore();
        Sequence sequence = store.getSequence(sequenceName);
        long value = nextValue ?
            store.sequenceNextValue(sequence) :
            store.sequenceCurrentValue(sequence);

        logger.debug("Sequence loading : {} -> {}", sequenceName, value);

        output.putInt64(value);
    }
View Full Code Here

                            int depth,
                            boolean withTransaction,
                            Schema schema,
                            Operator plan,
                            FormatOptions options) {
        StoreAdapter adapter = getAdapter(session, table, schema);
        QueryContext queryContext = new SimpleQueryContext(adapter) {
                @Override
                public ServiceManager getServiceManager() {
                    return serviceManager;
                }
View Full Code Here

TOP

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

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.