Search in sources :

Example 26 with ISchemaBuilder

use of org.apache.hadoop.hive.metastore.client.builder.ISchemaBuilder in project hive by apache.

the class TestHiveMetaStoreSchemaMethods method addDuplicateSchemaVersion.

@Test(expected = AlreadyExistsException.class)
public void addDuplicateSchemaVersion() throws TException {
    String schemaName = uniqueSchemaName();
    int version = 1;
    ISchema schema = new ISchemaBuilder().setSchemaType(SchemaType.AVRO).setName(schemaName).build();
    client.createISchema(schema);
    SchemaVersion schemaVersion = new SchemaVersionBuilder().versionOf(schema).setVersion(version).addCol("a", ColumnType.INT_TYPE_NAME).addCol("b", ColumnType.FLOAT_TYPE_NAME).build();
    client.addSchemaVersion(schemaVersion);
    client.addSchemaVersion(schemaVersion);
}
Also used : ISchemaBuilder(org.apache.hadoop.hive.metastore.client.builder.ISchemaBuilder) SchemaVersion(org.apache.hadoop.hive.metastore.api.SchemaVersion) ISchema(org.apache.hadoop.hive.metastore.api.ISchema) SchemaVersionBuilder(org.apache.hadoop.hive.metastore.client.builder.SchemaVersionBuilder) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 27 with ISchemaBuilder

use of org.apache.hadoop.hive.metastore.client.builder.ISchemaBuilder in project hive by apache.

the class TestHiveMetaStoreSchemaMethods method schemaVersionBogusCatalog.

@Test(expected = NoSuchObjectException.class)
public void schemaVersionBogusCatalog() throws TException {
    String schemaName = uniqueSchemaName();
    ISchema schema = new ISchemaBuilder().setSchemaType(SchemaType.AVRO).setName(schemaName).build();
    client.createISchema(schema);
    client.getSchemaVersion("bogus", DEFAULT_DATABASE_NAME, schemaName, 1);
}
Also used : ISchemaBuilder(org.apache.hadoop.hive.metastore.client.builder.ISchemaBuilder) ISchema(org.apache.hadoop.hive.metastore.api.ISchema) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 28 with ISchemaBuilder

use of org.apache.hadoop.hive.metastore.client.builder.ISchemaBuilder in project hive by apache.

the class TestHiveMetaStoreSchemaMethods method schemaAlreadyExists.

@Test(expected = AlreadyExistsException.class)
public void schemaAlreadyExists() throws TException {
    String schemaName = uniqueSchemaName();
    ISchema schema = new ISchemaBuilder().setSchemaType(SchemaType.HIVE).setName(schemaName).build();
    client.createISchema(schema);
    Assert.assertNotNull(schema);
    Assert.assertEquals(SchemaType.HIVE, schema.getSchemaType());
    Assert.assertEquals(schemaName, schema.getName());
    Assert.assertEquals(SchemaCompatibility.BACKWARD, schema.getCompatibility());
    Assert.assertEquals(SchemaValidation.ALL, schema.getValidationLevel());
    Assert.assertTrue(schema.isCanEvolve());
    // This second attempt to create it should throw
    client.createISchema(schema);
}
Also used : ISchemaBuilder(org.apache.hadoop.hive.metastore.client.builder.ISchemaBuilder) ISchema(org.apache.hadoop.hive.metastore.api.ISchema) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 29 with ISchemaBuilder

use of org.apache.hadoop.hive.metastore.client.builder.ISchemaBuilder in project hive by apache.

the class TestHiveMetaStoreSchemaMethods method allSchemaVersionBogusCatalog.

@Test(expected = NoSuchObjectException.class)
public void allSchemaVersionBogusCatalog() throws TException {
    String schemaName = uniqueSchemaName();
    ISchema schema = new ISchemaBuilder().setSchemaType(SchemaType.AVRO).setName(schemaName).build();
    client.createISchema(schema);
    client.getSchemaAllVersions("bogus", DEFAULT_DATABASE_NAME, schemaName);
}
Also used : ISchemaBuilder(org.apache.hadoop.hive.metastore.client.builder.ISchemaBuilder) ISchema(org.apache.hadoop.hive.metastore.api.ISchema) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 30 with ISchemaBuilder

use of org.apache.hadoop.hive.metastore.client.builder.ISchemaBuilder in project hive by apache.

the class TestHiveMetaStoreSchemaMethods method allSchemaVersionBogusDb.

@Test(expected = NoSuchObjectException.class)
public void allSchemaVersionBogusDb() throws TException {
    String schemaName = uniqueSchemaName();
    ISchema schema = new ISchemaBuilder().setSchemaType(SchemaType.AVRO).setName(schemaName).build();
    client.createISchema(schema);
    client.getSchemaAllVersions(DEFAULT_CATALOG_NAME, "bogus", schemaName);
}
Also used : ISchemaBuilder(org.apache.hadoop.hive.metastore.client.builder.ISchemaBuilder) ISchema(org.apache.hadoop.hive.metastore.api.ISchema) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Aggregations

MetastoreCheckinTest (org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)36 ISchema (org.apache.hadoop.hive.metastore.api.ISchema)36 ISchemaBuilder (org.apache.hadoop.hive.metastore.client.builder.ISchemaBuilder)36 Test (org.junit.Test)36 SchemaVersion (org.apache.hadoop.hive.metastore.api.SchemaVersion)16 SchemaVersionBuilder (org.apache.hadoop.hive.metastore.client.builder.SchemaVersionBuilder)16 Database (org.apache.hadoop.hive.metastore.api.Database)12 ISchemaName (org.apache.hadoop.hive.metastore.api.ISchemaName)7 FieldSchema (org.apache.hadoop.hive.metastore.api.FieldSchema)5 DatabaseBuilder (org.apache.hadoop.hive.metastore.client.builder.DatabaseBuilder)5 Catalog (org.apache.hadoop.hive.metastore.api.Catalog)4 NoSuchObjectException (org.apache.hadoop.hive.metastore.api.NoSuchObjectException)4 SchemaVersionDescriptor (org.apache.hadoop.hive.metastore.api.SchemaVersionDescriptor)4 SerDeInfo (org.apache.hadoop.hive.metastore.api.SerDeInfo)4 CatalogBuilder (org.apache.hadoop.hive.metastore.client.builder.CatalogBuilder)4 ArrayList (java.util.ArrayList)1 FindSchemasByColsResp (org.apache.hadoop.hive.metastore.api.FindSchemasByColsResp)1 FindSchemasByColsRqst (org.apache.hadoop.hive.metastore.api.FindSchemasByColsRqst)1