Package com.foundationdb.qp.operator

Examples of com.foundationdb.qp.operator.StoreAdapter


        writeRows(row(cid, "e", 3));

        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        TableRowType cType = schema.tableRowType(getTable(SCHEMA, C_TABLE));
        StoreAdapter adapter = newStoreAdapter(schema);
        long pk = 1L;
        compareRows(
                new Row[]{
                        testRow(cType, "a", 0, pk++),
                        testRow(cType, "b", 0, pk++),
                        testRow(cType, "c", 0, pk++),
                        testRow(cType, "d", 0, pk++),
                        testRow(cType, "e", 3, pk++),
                },
                adapter.newGroupCursor(cType.table().getGroup())
        );
    }
View Full Code Here


        writeRows(row(cid, "e"));

        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        TableRowType cType = schema.tableRowType(getTable(SCHEMA, C_TABLE));
        StoreAdapter adapter = newStoreAdapter(schema);
        long pk = 1L;
        compareRows(
                new Row[]{
                        testRow(cType, "a", pk++),
                        testRow(cType, "b", pk++),
                        testRow(cType, "c", pk++),
                        testRow(cType, "d", pk++),
                        testRow(cType, "e", pk++),
                },
                adapter.newGroupCursor(cType.table().getGroup())
        );
    }
View Full Code Here

        registerISTable(table, factory);
        Table newtable = ais().getTable(TEST_NAME);
       
        TestSession sqlSession = new TestSession();

        StoreAdapter adapter = sqlSession.getStoreHolder(SchemaCache.globalSchema(ais())).getAdapter(newtable);
        assertNotNull (adapter);
        assertTrue (adapter instanceof MemoryAdapter);
    }
View Full Code Here

        Row[] rows = new Row[expected.length];
        for (int i = 0; i < expected.length; i++) {
            rows[i] = new TestRow(rowType, expected[i]);
        }
       
        StoreAdapter adapter = newStoreAdapter(schema);
        QueryContext queryContext = new SimpleQueryContext(adapter);
       
        List<TableRowType> keepTypes = Arrays.asList(rowType);
       
        compareRows (
View Full Code Here

        IndexRowType rowType = schema.indexRowType(index);
        Row[] rows = new Row[expected.length];
        for(int i = 0; i < expected.length; ++i) {
            rows[i] = new TestRow(rowType, expected[i]);
        }
        StoreAdapter adapter = newStoreAdapter(schema);
        QueryContext queryContext = new SimpleQueryContext(adapter);
        compareRows(
            rows,
            API.cursor(
                API.indexScan_Default(rowType, false, IndexKeyRange.unbounded(rowType)),
View Full Code Here

          "CREATE TABLE t1(id INT PRIMARY KEY NOT NULL, s VARCHAR(128)) STORAGE_FORMAT protobuf");
        int t1 = ddl().getTableId(session(), new TableName(SCHEMA, "t1"));

        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        RowType t1Type = schema.tableRowType(getTable(t1));
        StoreAdapter adapter = newStoreAdapter(schema);

        txnService().beginTransaction(session());

        Object[] r1 = { 1L, "Fred" };
        Object[] r2 = { 2L, "Barney" };
        writeRow(t1, r1);
        writeRow(t1, r2);

        Row[] expected = {
            new TestRow(t1Type, r1),
            new TestRow(t1Type, r2)
        };
        compareRows(expected, adapter.newGroupCursor(t1Type.table().getGroup()));

        txnService().commitTransaction(session());
    }
View Full Code Here

            for(ChangeSet cs : changeSets) {
                RowType rowType = oldSchema.tableRowType(cs.getTableId());
                groupMap.put(rowType.table().getGroup(), rowType);
            }
            // Scan all affected groups
            StoreAdapter adapter = store.createAdapter(session, oldSchema);
            final TransformCache transformCache = getTransformCache(session, null);
            for(Entry<Group, Collection<RowType>> entry : groupMap.asMap().entrySet()) {
                Operator plan = API.filter_Default(API.groupScan_Default(entry.getKey()), entry.getValue());
                runPlan(session, contextIfNull(context, adapter), schemaManager,  txnService, plan, new RowHandler() {
                    @Override
View Full Code Here

            tableIndexes.put(transform.rowType.table().getGroup(), transform.rowType);
            groupIndexes.addAll(transform.groupIndexes);
        }

        AkibanInformationSchema onlineAIS = schemaManager.getOnlineAIS(session);
        StoreAdapter adapter = store.createAdapter(session, SchemaCache.globalSchema(onlineAIS));
        if(!tableIndexes.isEmpty()) {
            buildTableIndexes(session, context, adapter, transformCache, tableIndexes);
        }
        if(!groupIndexes.isEmpty()) {
            if(changeLevel == ChangeLevel.INDEX_CONSTRAINT) {
View Full Code Here

                stmt = parser.parseStatement(statement);
            } catch (StandardException e) {
                throw new SQLParserInternalException(e);//make specific runtime error unexpectedException
            }
            AkibanInformationSchema onlineAIS = schemaManager.getOnlineAIS(session);
            StoreAdapter adapter = store.createAdapter(session, SchemaCache.globalSchema(onlineAIS));
            CreateAsCompiler compiler = new CreateAsCompiler(server, adapter, false, onlineAIS);
            DMLStatementNode dmlStmt = (DMLStatementNode) stmt;
            PlanContext planContext = new PlanContext(compiler);

            BasePlannable result = compiler.compile(dmlStmt, null, planContext);
View Full Code Here

        final AkibanInformationSchema origAIS = schemaManager.getAis(session);
        final AkibanInformationSchema newAIS = schemaManager.getOnlineAIS(session);

        final Schema origSchema = SchemaCache.globalSchema(origAIS);
        final StoreAdapter origAdapter = store.createAdapter(session, origSchema);
        final QueryContext origContext = new DelegatingContext(origAdapter, context);
        final QueryBindings origBindings = origContext.createBindings();

        final TransformCache transformCache = getTransformCache(session, null);
        Set<Table> origRoots = findOldRoots(changeSets, origAIS, newAIS);

        for(Table root : origRoots) {
            Operator plan = API.groupScan_Default(root.getGroup());
            runPlan(session, contextIfNull(context, origAdapter), schemaManager, txnService, plan, new RowHandler() {
                @Override
                public void handleRow(Row oldRow) {
                    TableTransform transform = transformCache.get(oldRow.rowType().typeId());
                    Row newRow = transformRow(origContext, origBindings, transform, oldRow);
                    origAdapter.writeRow(newRow, transform.tableIndexes, transform.groupIndexes);
                }
            });
        }
    }
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.