Search in sources :

Example 1 with PartitionValuesRequest

use of org.apache.hadoop.hive.metastore.api.PartitionValuesRequest in project hive by apache.

the class TestListPartitions method testListPartitionValuesEmptySchema.

@Test
public void testListPartitionValuesEmptySchema() throws Exception {
    try {
        List<List<String>> testValues = createTable4PartColsParts(client);
        List<FieldSchema> partitionSchema = Lists.newArrayList();
        PartitionValuesRequest request = new PartitionValuesRequest(DB_NAME, TABLE_NAME, partitionSchema);
        client.listPartitionValues(request);
        fail("Should have thrown exception");
    } catch (IndexOutOfBoundsException | TTransportException e) {
    // TODO: should not throw different exceptions for different HMS deployment types
    }
}
Also used : PartitionValuesRequest(org.apache.hadoop.hive.metastore.api.PartitionValuesRequest) FieldSchema(org.apache.hadoop.hive.metastore.api.FieldSchema) TTransportException(org.apache.thrift.transport.TTransportException) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 2 with PartitionValuesRequest

use of org.apache.hadoop.hive.metastore.api.PartitionValuesRequest in project hive by apache.

the class TestListPartitions method testListPartitionValuesNoTable.

@Test(expected = MetaException.class)
public void testListPartitionValuesNoTable() throws Exception {
    List<FieldSchema> partitionSchema = Lists.newArrayList(new FieldSchema("yyyy", "string", ""), new FieldSchema("mm", "string", ""));
    PartitionValuesRequest request = new PartitionValuesRequest(DB_NAME, TABLE_NAME, partitionSchema);
    client.listPartitionValues(request);
}
Also used : PartitionValuesRequest(org.apache.hadoop.hive.metastore.api.PartitionValuesRequest) FieldSchema(org.apache.hadoop.hive.metastore.api.FieldSchema) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 3 with PartitionValuesRequest

use of org.apache.hadoop.hive.metastore.api.PartitionValuesRequest in project hive by apache.

the class TestListPartitions method testListPartitionValues.

/**
 * Testing listPartitionValues(PartitionValuesRequest) ->
 *         get_partition_values(PartitionValuesRequest).
 * @throws Exception
 */
@Test
public void testListPartitionValues() throws Exception {
    List<List<String>> testValues = createTable4PartColsParts(client);
    List<FieldSchema> partitionSchema = Lists.newArrayList(new FieldSchema("yyyy", "string", ""), new FieldSchema("mm", "string", ""));
    PartitionValuesRequest request = new PartitionValuesRequest(DB_NAME, TABLE_NAME, partitionSchema);
    PartitionValuesResponse response = client.listPartitionValues(request);
    assertCorrectPartitionValuesResponse(testValues, response);
}
Also used : PartitionValuesRequest(org.apache.hadoop.hive.metastore.api.PartitionValuesRequest) FieldSchema(org.apache.hadoop.hive.metastore.api.FieldSchema) PartitionValuesResponse(org.apache.hadoop.hive.metastore.api.PartitionValuesResponse) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 4 with PartitionValuesRequest

use of org.apache.hadoop.hive.metastore.api.PartitionValuesRequest in project hive by apache.

the class TestListPartitions method testListPartitionValuesNullSchema.

@Test
public void testListPartitionValuesNullSchema() throws Exception {
    try {
        createTable4PartColsParts(client);
        PartitionValuesRequest request = new PartitionValuesRequest(DB_NAME, TABLE_NAME, null);
        client.listPartitionValues(request);
        fail("Should have thrown exception");
    } catch (NullPointerException | TProtocolException e) {
    // TODO: should not throw different exceptions for different HMS deployment types
    }
}
Also used : PartitionValuesRequest(org.apache.hadoop.hive.metastore.api.PartitionValuesRequest) TProtocolException(org.apache.thrift.protocol.TProtocolException) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 5 with PartitionValuesRequest

use of org.apache.hadoop.hive.metastore.api.PartitionValuesRequest in project hive by apache.

the class TestListPartitions method testListPartitionValuesNullTblName.

@Test
public void testListPartitionValuesNullTblName() throws Exception {
    try {
        createTable4PartColsParts(client);
        List<FieldSchema> partitionSchema = Lists.newArrayList(new FieldSchema("yyyy", "string", ""), new FieldSchema("mm", "string", ""));
        PartitionValuesRequest request = new PartitionValuesRequest(DB_NAME, null, partitionSchema);
        client.listPartitionValues(request);
        fail("Should have thrown exception");
    } catch (NullPointerException | TProtocolException e) {
    // TODO: should not throw different exceptions for different HMS deployment types
    }
}
Also used : PartitionValuesRequest(org.apache.hadoop.hive.metastore.api.PartitionValuesRequest) FieldSchema(org.apache.hadoop.hive.metastore.api.FieldSchema) TProtocolException(org.apache.thrift.protocol.TProtocolException) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Aggregations

MetastoreCheckinTest (org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)9 PartitionValuesRequest (org.apache.hadoop.hive.metastore.api.PartitionValuesRequest)9 Test (org.junit.Test)9 FieldSchema (org.apache.hadoop.hive.metastore.api.FieldSchema)8 TProtocolException (org.apache.thrift.protocol.TProtocolException)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 PartitionValuesResponse (org.apache.hadoop.hive.metastore.api.PartitionValuesResponse)1 TTransportException (org.apache.thrift.transport.TTransportException)1