Package com.foundationdb.qp.operator

Examples of com.foundationdb.qp.operator.QueryContext


        }
    }

    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<>();
            Row row;
            while((row = cursor.next()) != null) {
View Full Code Here


        return row(rowType, fields);
    }

    public Row row(RowType rowType, Object... fields) {
        if(fields.length < rowType.nFields()) {
            QueryContext context = new SimpleQueryContext(newStoreAdapter(rowType.schema()));
            List<TPreparedExpression> expressions = new ArrayList<>();
            for(int i = 0; i < fields.length; ++i) {
                TInstance type = rowType.typeAt(i);
                TPreptimeValue val = ValueSources.fromObject(fields[i], type);
                expressions.add(new TPreparedLiteral(type, val.value()));
            }
            for(int i = fields.length; i < rowType.nFields(); ++i) {
                Column col = getColumn(rowType, i);
                if(col == null) {
                    throw new IllegalArgumentException("Column " + i + "not specified and no default: " + rowType);
                }
                expressions.add(PlanGenerator.generateDefaultExpression(col, null, typesRegistryService(), ddl().getTypesTranslator(), context));
            }
            return new ExpressionRow(rowType, context, context.createBindings(), expressions);
        } else {
            return new TestRow(rowType, fields);
        }
    }
View Full Code Here

            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 {
                    Row row;
                    while((row = cursor.next()) != null) {
View Full Code Here

            @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();
                try {
                    Row row;
View Full Code Here

        ALL_TAP.in();
        try {
            Operator planOperator = rootOperator();
            if (planOperator == null)
                return;
            QueryContext context = new SimpleQueryContext(adapter);
            QueryBindings bindings = context.createBindings();
            List<Column> lookupCols = rowType.table().getPrimaryKeyIncludingInternal().getColumns();

            bindings.setHKey(StoreGIMaintenance.HKEY_BINDING_POSITION, hKey);

            // Copy the values into the array bindings
View Full Code Here

                    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;
            do {
                row = cursor.next();
View Full Code Here

                EnumSet.of(IntersectOption.OUTPUT_LEFT, IntersectOption.SKIP_SCAN),
                null,
                true
        );

        QueryContext context = new SimpleQueryContext(newStoreAdapter(schema));
        Cursor cursor = API.cursor(outerIntersect, context, context.createBindings());
        compareRows(
            new Row[] {
                testRow(mdIndex, "x", "one", 3, 30)
            },
            cursor
View Full Code Here

    private void populateIndex(Session session, FullTextIndex index) {
        final FullTextIndexInfo indexInfo = getIndex(session, index.getIndexName(), index.getIndexedTable().getAIS());
        boolean success = false;
        try {
            StoreAdapter adapter = store.createAdapter(session, indexInfo.getSchema());
            QueryContext queryContext = new SimpleQueryContext(adapter);
            Cursor cursor = null;
            Indexer indexer = indexInfo.getIndexer();
            try(RowIndexer rowIndexer = new RowIndexer(indexInfo, indexer.getWriter(), false)) {
                cursor = API.cursor(indexInfo.fullScan(), queryContext, queryContext.createBindings());
                long count = rowIndexer.indexRows(cursor);
                logger.debug("Populated {} with {} rows", indexInfo.getIndex().getIndexName(), count);
            } finally {
                if(cursor != null && !cursor.isClosed()) {
                    cursor.close();
View Full Code Here

                            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;
                }
            };
        QueryBindings queryBindings = queryContext.createBindings();
        JsonRowWriter json = new JsonRowWriter(new TableRowTracker(table, depth));
        WriteTableRow rowWriter = new WriteTableRow();
        AkibanAppender appender = AkibanAppender.of(writer);
        boolean transaction = false;
        Cursor cursor = null;
View Full Code Here

        }
    }

    private void updateIndex(Session session, FullTextIndexInfo indexInfo, Iterable<byte[]> rows) throws IOException {
        StoreAdapter adapter = store.createAdapter(session, indexInfo.getSchema());
        QueryContext queryContext = new SimpleQueryContext(adapter);
        QueryBindings queryBindings = queryContext.createBindings();

        Cursor cursor = null;
        IndexWriter writer = indexInfo.getIndexer().getWriter();
        try(RowIndexer rowIndexer = new RowIndexer(indexInfo, writer, true)) {
            Operator operator = indexInfo.getOperator();
View Full Code Here

TOP

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

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.