Package com.nearinfinity.honeycomb.mysql.schema

Examples of com.nearinfinity.honeycomb.mysql.schema.IndexSchema


        // Add nullable, non-autoincrementing columns
        columns.add(ColumnSchema.builder(TestConstants.COLUMN1, ColumnType.LONG).build());
        columns.add(ColumnSchema.builder(TestConstants.COLUMN2, ColumnType.LONG).build());

        // Add non-unique index on one column
        indices.add(new IndexSchema(TestConstants.INDEX1, Lists.newArrayList(TestConstants.COLUMN1), false));

        // Add non-unique compound index on (c1, c2)
        indices.add(new IndexSchema(TestConstants.INDEX2, Lists.newArrayList(TestConstants.COLUMN1, TestConstants.COLUMN2), false));

        // Add unique index on one column
        indices.add(new IndexSchema(TestConstants.INDEX3, Lists.newArrayList(TestConstants.COLUMN1), true));

        return new TableSchema(columns, indices);
    }
View Full Code Here


    private static final int INDEX_COL_VALUE = 5;
    private static final String NEW_INDEX_NAME = "i3";

    @Test
    public void testAddIndex() {
        final IndexSchema indexSchema = new IndexSchema(NEW_INDEX_NAME, Lists.newArrayList(TestConstants.COLUMN1), false);

        // Add data rows to index
        ITUtils.insertData(proxy, ROW_COUNT, INDEX_COL_VALUE);

        // Add the new index to the table
        proxy.addIndex(NEW_INDEX_NAME, indexSchema.serialize());

        // Perform a scan with the new index

        final QueryKey key = new QueryKey(NEW_INDEX_NAME, QueryType.EXACT_KEY,
                ImmutableMap.<String, ByteBuffer>of(TestConstants.COLUMN1, ITUtils.encodeValue(INDEX_COL_VALUE)));
View Full Code Here

    }

    @Test
    public void testAddCompoundIndex() {
        // Create the compound index ordered as (col2, col1)
        final IndexSchema indexSchema = new IndexSchema(NEW_INDEX_NAME, Lists.newArrayList(TestConstants.COLUMN2, TestConstants.COLUMN1), false);

        final int column2Value = 0;

        // Add data rows to index
        ITUtils.insertData(proxy, ROW_COUNT, INDEX_COL_VALUE);

        // Add the new index to the table
        proxy.addIndex(NEW_INDEX_NAME, indexSchema.serialize());

        // Perform a scan with the new index

        final QueryKey key = new QueryKey(NEW_INDEX_NAME, QueryType.EXACT_KEY,
                ImmutableMap.<String, ByteBuffer>of(TestConstants.COLUMN1, ITUtils.encodeValue(INDEX_COL_VALUE),
View Full Code Here

    @Override
    public IndexSchema next() {
        Collections.shuffle(columnNames);
        List<String> columns = columnNames.subList(0, Math.min(lengthGen.next(), columnNames.size()));
        return new IndexSchema(MYSQL_NAME_GEN.next(), columns, RAND.nextBoolean());
    }
View Full Code Here

TOP

Related Classes of com.nearinfinity.honeycomb.mysql.schema.IndexSchema

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.