@Test public void testListPartitionValuesNullRequest() throws Exception { try { createTable4PartColsParts(client); client.listPartitionValues(null); fail("Should have thrown exception"); } catch (NullPointerException | TTransportException e) { //TODO: should not throw different exceptions for different HMS deployment types } }
@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); }
@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 } }
@Test(expected = NoSuchObjectException.class) public void testListPartitionValuesNoDbName() throws Exception { createTable4PartColsParts(client); List<FieldSchema> partitionSchema = Lists.newArrayList( new FieldSchema("yyyy", "string", ""), new FieldSchema("mm", "string", "")); PartitionValuesRequest request = new PartitionValuesRequest("", TABLE_NAME, partitionSchema); client.listPartitionValues(request); }
@Test(expected = NoSuchObjectException.class) public void testListPartitionValuesNoTblName() throws Exception { createTable4PartColsParts(client); List<FieldSchema> partitionSchema = Lists.newArrayList( new FieldSchema("yyyy", "string", ""), new FieldSchema("mm", "string", "")); PartitionValuesRequest request = new PartitionValuesRequest(DB_NAME, "", partitionSchema); client.listPartitionValues(request); }
@Test(expected = MetaException.class) public void testListPartitionValuesNoDb() throws Exception { client.dropDatabase(DB_NAME); 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); }
@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 } }
@Test(expected = MetaException.class) public void listPartitionValuesBogusCatalog() throws TException { createTable3PartCols1Part(client); PartitionValuesRequest rqst = new PartitionValuesRequest(DB_NAME, TABLE_NAME, Lists.newArrayList(new FieldSchema("partcol", "string", ""))); rqst.setCatName("bogus"); client.listPartitionValues(rqst); } }
@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 } }
/** * Testing listPartitionValues(PartitionValuesRequest) -> * get_partition_values(PartitionValuesRequest). */ @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); }
@Test public void testListPartitionValuesNullDbName() throws Exception { try { createTable4PartColsParts(client); List<FieldSchema> partitionSchema = Lists.newArrayList( new FieldSchema("yyyy", "string", ""), new FieldSchema("mm", "string", "")); PartitionValuesRequest request = new PartitionValuesRequest(null, TABLE_NAME, partitionSchema); client.listPartitionValues(request); fail("Should have thrown exception"); } catch (NullPointerException | TProtocolException e) { //TODO: should not throw different exceptions for different HMS deployment types } }
PartitionValuesResponse rsp = client.listPartitionValues(rqst); Assert.assertEquals(5, rsp.getPartitionValuesSize());
tableName, Lists.newArrayList(new FieldSchema("partcol", "string", ""))); rqst.setCatName(catName); PartitionValuesResponse rsp = client.listPartitionValues(rqst); Assert.assertEquals(5, rsp.getPartitionValuesSize());