Search in sources :

Example 11 with PartitionsByExprRequest

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

the class TestSessionHiveMetastoreClientListPartitionsTempTable method testListPartitionsSpecByExprNullTblName.

@Test(expected = MetaException.class)
public void testListPartitionsSpecByExprNullTblName() throws Exception {
    PartitionsByExprRequest req = new PartitionsByExprRequest(DB_NAME, null, ByteBuffer.wrap(new byte[] { 'f', 'o', 'o' }));
    req.setMaxParts((short) -1);
    getClient().listPartitionsSpecByExpr(req, null);
}
Also used : PartitionsByExprRequest(org.apache.hadoop.hive.metastore.api.PartitionsByExprRequest) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 12 with PartitionsByExprRequest

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

the class TestSessionHiveMetastoreClientListPartitionsTempTable method testListPartitionsSpecByExprNullDbName.

@Test(expected = MetaException.class)
public void testListPartitionsSpecByExprNullDbName() throws Exception {
    PartitionsByExprRequest req = new PartitionsByExprRequest(null, TABLE_NAME, ByteBuffer.wrap(new byte[] { 'f', 'o', 'o' }));
    req.setMaxParts((short) -1);
    getClient().listPartitionsSpecByExpr(req, null);
}
Also used : PartitionsByExprRequest(org.apache.hadoop.hive.metastore.api.PartitionsByExprRequest) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 13 with PartitionsByExprRequest

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

the class TestSessionHiveMetastoreClientListPartitionsTempTable method testListPartitionsSpecByExprNullResult.

@Test(expected = AssertionError.class)
public void testListPartitionsSpecByExprNullResult() throws Exception {
    Table t = createTable4PartColsParts(getClient()).table;
    TestMetastoreExpr.ExprBuilder e = new TestMetastoreExpr.ExprBuilder(TABLE_NAME);
    PartitionsByExprRequest req = new PartitionsByExprRequest(DB_NAME, TABLE_NAME, ByteBuffer.wrap(SerializationUtilities.serializeExpressionToKryo(e.strCol("yyyy").val("2017").pred("=", 2).build())));
    req.setMaxParts((short) -1);
    req.setId(t.getId());
    getClient().listPartitionsSpecByExpr(req, null);
}
Also used : Table(org.apache.hadoop.hive.metastore.api.Table) PartitionsByExprRequest(org.apache.hadoop.hive.metastore.api.PartitionsByExprRequest) TestMetastoreExpr(org.apache.hadoop.hive.metastore.TestMetastoreExpr) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 14 with PartitionsByExprRequest

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

the class TestSessionHiveMetastoreClientListPartitionsTempTable method testListPartitionsSpecByExprHighMaxParts.

@Test
public void testListPartitionsSpecByExprHighMaxParts() throws Exception {
    Table t = createTable4PartColsParts(getClient()).table;
    TestMetastoreExpr.ExprBuilder e = new TestMetastoreExpr.ExprBuilder(TABLE_NAME);
    List<PartitionSpec> result = new ArrayList<>();
    PartitionsByExprRequest req = new PartitionsByExprRequest(DB_NAME, TABLE_NAME, ByteBuffer.wrap(SerializationUtilities.serializeExpressionToKryo(e.strCol("yyyy").val("2017").pred(">=", 2).build())));
    req.setMaxParts((short) 100);
    req.setId(t.getId());
    getClient().listPartitionsSpecByExpr(req, result);
    assertEquals(4, result.iterator().next().getSharedSDPartitionSpec().getPartitionsSize());
}
Also used : Table(org.apache.hadoop.hive.metastore.api.Table) PartitionsByExprRequest(org.apache.hadoop.hive.metastore.api.PartitionsByExprRequest) ArrayList(java.util.ArrayList) PartitionSpec(org.apache.hadoop.hive.metastore.api.PartitionSpec) TestMetastoreExpr(org.apache.hadoop.hive.metastore.TestMetastoreExpr) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Example 15 with PartitionsByExprRequest

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

the class TestSessionHiveMetastoreClientListPartitionsTempTable method testListPartitionsSpecByExprNoTbl.

@Test(expected = NoSuchObjectException.class)
public void testListPartitionsSpecByExprNoTbl() throws Exception {
    PartitionsByExprRequest req = new PartitionsByExprRequest(DB_NAME, TABLE_NAME, ByteBuffer.wrap(new byte[] { 'f', 'o', 'o' }));
    req.setMaxParts((short) -1);
    getClient().listPartitionsSpecByExpr(req, new ArrayList<>());
}
Also used : PartitionsByExprRequest(org.apache.hadoop.hive.metastore.api.PartitionsByExprRequest) Test(org.junit.Test) MetastoreCheckinTest(org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)

Aggregations

PartitionsByExprRequest (org.apache.hadoop.hive.metastore.api.PartitionsByExprRequest)16 MetastoreCheckinTest (org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest)9 Test (org.junit.Test)9 ArrayList (java.util.ArrayList)6 PartitionSpec (org.apache.hadoop.hive.metastore.api.PartitionSpec)5 Table (org.apache.hadoop.hive.metastore.api.Table)5 TestMetastoreExpr (org.apache.hadoop.hive.metastore.TestMetastoreExpr)3 Partition (org.apache.hadoop.hive.metastore.api.Partition)3 ValidWriteIdList (org.apache.hadoop.hive.common.ValidWriteIdList)2 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)2 NoSuchObjectException (org.apache.hadoop.hive.metastore.api.NoSuchObjectException)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 ExecutionException (java.util.concurrent.ExecutionException)1 JDODataStoreException (javax.jdo.JDODataStoreException)1 HiveMetaException (org.apache.hadoop.hive.metastore.HiveMetaException)1 AlreadyExistsException (org.apache.hadoop.hive.metastore.api.AlreadyExistsException)1 DropPartitionsExpr (org.apache.hadoop.hive.metastore.api.DropPartitionsExpr)1 DropPartitionsResult (org.apache.hadoop.hive.metastore.api.DropPartitionsResult)1