Examples of TableSchema


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

        hbaseMetadata.createTableIndex(1, null);
    }

    @Test
    public void testCreateIndex() {
        final TableSchema tableSchema = new TableSchema(COLUMN_SCHEMAS, ImmutableList.<IndexSchema>of());

        // Create a new table with the configured details
        hbaseMetadata.createTable(TABLE_NAME, tableSchema);
        final long tableId = hbaseMetadata.getTableId(TABLE_NAME);

        // Verify that the table schema has no indices after creation
        final TableSchema schemaBefore = hbaseMetadata.getSchema(tableId);
        assertNotNull(schemaBefore);
        assertTrue(schemaBefore.getIndices().isEmpty());

        // Add a new index to the table
        hbaseMetadata.createTableIndex(tableId,
                new IndexSchema(INDEX_NAME, ImmutableList.<String>of(COLUMN_NAME), false));

        // Verify that the table schema has been correctly updated

        final TableSchema schemaAfter = hbaseMetadata.getSchema(tableId);
        assertNotNull(schemaAfter);

        final Collection<IndexSchema> schemaIndices = schemaAfter.getIndices();
        assertEquals(1, schemaIndices.size());


        final IndexSchema newIndexDetails = Iterables.find(schemaIndices, indexPredicate);
        assertNotNull(newIndexDetails);
View Full Code Here

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

        hbaseMetadata.deleteTableIndex(1, "");
    }

    @Test
    public void testDeleteIndex() {
        final TableSchema tableSchema =
                new TableSchema(COLUMN_SCHEMAS,
                        ImmutableList.<IndexSchema>of(
                                new IndexSchema(INDEX_NAME, Lists.newArrayList(COLUMN_NAME), false)));

        // Create a new table with the configured details
        hbaseMetadata.createTable(TABLE_NAME, tableSchema);
        final long tableId = hbaseMetadata.getTableId(TABLE_NAME);


        // Verify that the table schema contains indices after creation

        final TableSchema schemaBefore = hbaseMetadata.getSchema(tableId);
        assertNotNull(schemaBefore);

        final Collection<IndexSchema> schemaIndices = schemaBefore.getIndices();
        assertEquals(1, schemaIndices.size());

        final IndexSchema newIndexDetails = Iterables.find(schemaIndices, indexPredicate);
        assertNotNull(newIndexDetails);

        final List<String> indexColumns = newIndexDetails.getColumns();
        assertEquals(1, indexColumns.size());
        assertEquals(COLUMN_NAME, indexColumns.get(0));

        // Verify that the index exists after table creation
        final Map<String, Long> tableIndexInfo = hbaseMetadata.getIndexIds(tableId);
        assertEquals(1, tableIndexInfo.size());
        assertTrue(tableIndexInfo.containsKey(INDEX_NAME));

        // Remove an existing index from the table
        hbaseMetadata.deleteTableIndex(tableId, INDEX_NAME);

        // Verify that the table schema has been correctly updated
        final TableSchema schemaAfter = hbaseMetadata.getSchema(tableId);
        assertNotNull(schemaAfter);
        assertTrue(schemaAfter.getIndices().isEmpty());

        // Verify that the index has been removed correctly
        assertTrue(hbaseMetadata.getIndexIds(tableId).isEmpty());
    }
View Full Code Here

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

        assertTrue(hbaseMetadata.getIndexIds(tableId).isEmpty());
    }

    @Test
    public void testAutoInc() throws Exception {
        TableSchema table = TABLE_SCHEMA_GEN.next();
        final String tableName = TableSchemaGenerator.MYSQL_NAME_GEN.next();

        hbaseMetadata.createTable(tableName, table);

        long tableId = hbaseMetadata.getTableId(tableName);
View Full Code Here

Examples of com.sun.messaging.jmq.jmsserver.persist.jdbc.comm.TableSchema

                            br.getString( BrokerResources.I_DROP_TABLE,
                                oldTableName ) );
                        stmt.executeUpdate( "DROP TABLE " + oldTableName );

                        if ( mgr.hasSupplementForCreateDrop(oldTableName) ) {
                             TableSchema schema = mgr.getTableSchema(oldTableName);
                             mgr.dropTableSupplement(stmt, schema, oldTableName, true);
                        }
                    }
                } catch (SQLException e) {
                    myex = e;
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableSchema

    if (!ProtobufUtil.isPBMagicPrefix(bytes)) {
      return (HTableDescriptor)Writables.getWritable(bytes, new HTableDescriptor());
    }
    int pblen = ProtobufUtil.lengthOfPBMagic();
    TableSchema.Builder builder = TableSchema.newBuilder();
    TableSchema ts;
    try {
      ts = builder.mergeFrom(bytes, pblen, bytes.length - pblen).build();
    } catch (InvalidProtocolBufferException e) {
      throw new DeserializationException(e);
    }
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableSchema

    if (!ProtobufUtil.isPBMagicPrefix(bytes)) {
      return (HTableDescriptor)Writables.getWritable(bytes, new HTableDescriptor());
    }
    int pblen = ProtobufUtil.lengthOfPBMagic();
    TableSchema.Builder builder = TableSchema.newBuilder();
    TableSchema ts;
    try {
      ts = builder.mergeFrom(bytes, pblen, bytes.length - pblen).build();
    } catch (InvalidProtocolBufferException e) {
      throw new DeserializationException(e);
    }
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableSchema

    if (!ProtobufUtil.isPBMagicPrefix(bytes)) {
      return (HTableDescriptor)Writables.getWritable(bytes, new HTableDescriptor());
    }
    int pblen = ProtobufUtil.lengthOfPBMagic();
    TableSchema.Builder builder = TableSchema.newBuilder();
    TableSchema ts;
    try {
      ts = builder.mergeFrom(bytes, pblen, bytes.length - pblen).build();
    } catch (InvalidProtocolBufferException e) {
      throw new DeserializationException(e);
    }
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableSchema

    if (!ProtobufUtil.isPBMagicPrefix(bytes)) {
      return (HTableDescriptor)Writables.getWritable(bytes, new HTableDescriptor());
    }
    int pblen = ProtobufUtil.lengthOfPBMagic();
    TableSchema.Builder builder = TableSchema.newBuilder();
    TableSchema ts;
    try {
      ts = builder.mergeFrom(bytes, pblen, bytes.length - pblen).build();
    } catch (InvalidProtocolBufferException e) {
      throw new DeserializationException(e);
    }
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableSchema

    if (!ProtobufUtil.isPBMagicPrefix(bytes)) {
      return (HTableDescriptor)Writables.getWritable(bytes, new HTableDescriptor());
    }
    int pblen = ProtobufUtil.lengthOfPBMagic();
    TableSchema.Builder builder = TableSchema.newBuilder();
    TableSchema ts;
    try {
      ts = builder.mergeFrom(bytes, pblen, bytes.length - pblen).build();
    } catch (InvalidProtocolBufferException e) {
      throw new DeserializationException(e);
    }
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableSchema

    if (!ProtobufUtil.isPBMagicPrefix(bytes)) {
      return (HTableDescriptor)Writables.getWritable(bytes, new HTableDescriptor());
    }
    int pblen = ProtobufUtil.lengthOfPBMagic();
    TableSchema.Builder builder = TableSchema.newBuilder();
    TableSchema ts;
    try {
      ts = builder.mergeFrom(bytes, pblen, bytes.length - pblen).build();
    } catch (InvalidProtocolBufferException e) {
      throw new DeserializationException(e);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.