Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.Index


    {
        super(context, iterationHelper);
        assert keyRange.spatial();
        this.multiCursor = new MultiCursor(openAll);
        this.iterationHelper = iterationHelper;
        Index spatialIndex = keyRange.indexRowType().index();
        assert spatialIndex.isSpatial() : spatialIndex;
        this.space = spatialIndex.space();
        this.latColumn = spatialIndex.firstSpatialArgument();
        this.lonColumn = latColumn + 1;
        API.Ordering zOrdering = new API.Ordering();
        IndexRowType rowType = keyRange.indexRowType().physicalRowType();
        for (int f = 0; f < rowType.nFields(); f++) {
            zOrdering.append(new TPreparedField(rowType.typeAt(f), f), true);
View Full Code Here


    }

    private List<IndexKeyRange> zKeyRanges(QueryContext context, IndexKeyRange keyRange)
    {
        List<IndexKeyRange> zKeyRanges = new ArrayList<>();
        Index index = keyRange.indexRowType().index();
        IndexBound loBound = keyRange.lo();
        IndexBound hiBound = keyRange.hi();
        ValueRecord loExpressions = loBound.boundExpressions(context, bindings);
        ValueRecord hiExpressions = hiBound.boundExpressions(context, bindings);
        // Only 2d, lat/lon supported for now
        double xLo, xHi, yLo, yHi;
        TInstance xinst = index.getAllColumns().get(latColumn).getColumn().getType();
        TInstance yinst = index.getAllColumns().get(lonColumn).getColumn().getType();
        xLo = TBigDecimal.getWrapper(loExpressions.value(latColumn), xinst).asBigDecimal().doubleValue();
        xHi = TBigDecimal.getWrapper(hiExpressions.value(latColumn), xinst).asBigDecimal().doubleValue();
        yLo = TBigDecimal.getWrapper(loExpressions.value(lonColumn), yinst).asBigDecimal().doubleValue();
        yHi = TBigDecimal.getWrapper(hiExpressions.value(lonColumn), yinst).asBigDecimal().doubleValue();
        SpatialObject box = BoxLatLon.newBox(xLo, xHi, yLo, yHi);
View Full Code Here

            types = sortKeyAdapter.createTInstances(orderingColumns);
            for (int i = 0; i < orderingColumns; ++i) {
                sortKeyAdapter.setOrderingMetadata(ordering, i, types);
            }
        } else {
            Index index = keyRange.indexRowType().index();
            keyColumns = index.indexRowComposition().getLength();
            startBoundColumns = keyRange.boundColumns();
            List<IndexColumn> indexColumns = index.getAllColumns();
            int nColumns = indexColumns.size();
            types = sortKeyAdapter.createTInstances(nColumns);
            for (int f = 0; f < nColumns; f++) {
                Column column = indexColumns.get(f).getColumn();
                sortKeyAdapter.setColumnMetadata(column, f, types);
View Full Code Here

        expectRows(
                tableId,
                row(tableId, 11, 21),
                row(tableId, 12, 22)
        );
        Index index = getTable(tableId).getIndex("u1");
        expectRows(
                index,
                row(index, 21, 11),
                row(index, 22, 12)
        );
View Full Code Here

        expectRows(
                tableId,
                row(tableId, 11),
                row(tableId, 12)
        );
        Index index = getTable(tableId).getIndex("cid");
        expectRows(
                index,
                row(index, 11),
                row(index, 12)
        );
View Full Code Here

    public void oneColumnNoPK() throws InvalidOperationException {
        final String tableName = "t1";
        final String schemaName = "s1";

        final int tableId;
        final Index index;
        final Row original;
        final Row updated;

        try {
            tableId = createTable(schemaName, tableName, "cid int", "UNIQUE(cid)");
View Full Code Here

    public void twoColumns() throws InvalidOperationException{

        final String tableName = "t1";
        final String schemaName = "s1";
        final int tableId;
        final Index index;
        try {
            tableId = createTable(schemaName, tableName, "cid int not null primary key", "u1 int", "u2 int", "UNIQUE(u1,u2)");
            index = getTable(tableId).getIndex("u1");
            writeRows(
                    row(tableId, 11, 21, 31),
View Full Code Here

        expectRows(
                tableId,
                row(tableId, 11, null),
                row(tableId, 12, null)
        );
        Index index = getTable(tableId).getIndex("u1");
        expectRows(
                index,
                row(index, null, 11),
                row(index, null, 12)
        );
View Full Code Here

                        "u int",
                        "unique(u)");
        writeRows(row(tableId, 0, 0));
        AkibanInformationSchema ais = ddl().getAIS(session());
        Table table = ais.getTable(tableId);
        Index uIndex = null;
        for (TableIndex index : table.getIndexes()) {
            if (index.getKeyColumns().get(0).getColumn().getName().equals("u")) {
                uIndex = index;
            }
        }
        assertNotNull(uIndex);
        final Index finalUIndex = uIndex;
        CyclicBarrier barrier = new CyclicBarrier(2);
        TestThread t1 = createThread(barrier, tableId, 100, 999);
        TestThread t2 = createThread(barrier, tableId, 101, 999);
        t1.join();
        t2.join();
View Full Code Here

            String tableName,
            String indexName,
            int expectedColumns,
            HistogramEntryDescription... entries
    ) {
        Index index =  PK.equals(indexName)
                ? getTable(SCHEMA, tableName).getPrimaryKey().getIndex()
                : getTable(SCHEMA, tableName).getIndex(indexName);
        validateHistogram(
                index, expectedColumns,
                entries
View Full Code Here

TOP

Related Classes of com.foundationdb.ais.model.Index

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.