diff --git ql/src/java/org/apache/hadoop/hive/ql/metadata/PartitionTree.java ql/src/java/org/apache/hadoop/hive/ql/metadata/PartitionTree.java index 00b4301f54..f518fc1499 100644 --- ql/src/java/org/apache/hadoop/hive/ql/metadata/PartitionTree.java +++ ql/src/java/org/apache/hadoop/hive/ql/metadata/PartitionTree.java @@ -22,7 +22,12 @@ import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.NoSuchObjectException; import org.apache.hadoop.hive.metastore.api.Partition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import javax.script.ScriptException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -30,6 +35,7 @@ import java.util.List; import java.util.Map; +import static org.apache.hadoop.hive.metastore.Warehouse.LOG; import static org.apache.hadoop.hive.metastore.Warehouse.makePartName; import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.makePartNameMatcher; @@ -38,6 +44,7 @@ * via references. */ final class PartitionTree { + private static final Logger LOG = LoggerFactory.getLogger(PartitionTree.class); private Map parts = new LinkedHashMap<>(); private final org.apache.hadoop.hive.metastore.api.Table tTable; @@ -233,4 +240,35 @@ void renamePartition(List oldPartitionVals, Partition newPart) throws MetaException, InvalidOperationException, NoSuchObjectException { alterPartition(oldPartitionVals, newPart, true); } + + /** + * Return a list of partitions matching the filter. + * @param filter filter string, must be not null. + * @return list of partitions, always not-null. + * @throws MetaException + */ + List getPartitionsByFilter(final String filter) throws MetaException { + if (filter == null || filter.isEmpty()) { + return new ArrayList<>(parts.values()); + } + List result = new ArrayList<>(); + ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript"); + if (se == null) { + LOG.error("JavaScript script engine is not found, therefore partition filtering " + + "for temporary tables is disabled."); + return result; + } + for (Map.Entry entry : parts.entrySet()) { + se.put("partitionName", entry.getKey()); + se.put("values", entry.getValue().getValues()); + try { + if ((Boolean)se.eval(filter)) { + result.add(entry.getValue()); + } + } catch (ScriptException e) { + throw new MetaException("Incorrect partition filter"); + } + } + return result; + } } diff --git ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java index db3d9dbca8..af77c4e9b9 100644 --- ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java +++ ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java @@ -32,7 +32,6 @@ import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; - import org.apache.commons.lang3.tuple.Pair; import org.apache.hadoop.conf.Configuration; @@ -41,10 +40,12 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.common.FileUtils; import org.apache.hadoop.hive.common.StatsSetupConst; +import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.io.HdfsUtils; import org.apache.hadoop.hive.metastore.HiveMetaHookLoader; import org.apache.hadoop.hive.metastore.HiveMetaStoreClient; import org.apache.hadoop.hive.metastore.IMetaStoreClient; +import org.apache.hadoop.hive.metastore.PartFilterExprUtil; import org.apache.hadoop.hive.metastore.PartitionDropOptions; import org.apache.hadoop.hive.metastore.TableType; import org.apache.hadoop.hive.metastore.Warehouse; @@ -64,12 +65,16 @@ import org.apache.hadoop.hive.metastore.api.Partition; import org.apache.hadoop.hive.metastore.api.PartitionListComposingSpec; import org.apache.hadoop.hive.metastore.api.PartitionSpec; +import org.apache.hadoop.hive.metastore.api.PartitionValuesRequest; +import org.apache.hadoop.hive.metastore.api.PartitionValuesResponse; +import org.apache.hadoop.hive.metastore.api.PartitionValuesRow; import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet; import org.apache.hadoop.hive.metastore.api.SetPartitionsStatsRequest; import org.apache.hadoop.hive.metastore.api.TableMeta; import org.apache.hadoop.hive.metastore.api.UnknownDBException; import org.apache.hadoop.hive.metastore.api.UnknownTableException; import org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder; +import org.apache.hadoop.hive.metastore.parser.ExpressionTree; import org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy; import org.apache.hadoop.hive.ql.parse.SemanticAnalyzer; import org.apache.hadoop.hive.metastore.utils.SecurityUtils; @@ -83,8 +88,9 @@ import static org.apache.hadoop.hive.metastore.Warehouse.getCatalogQualifiedTableName; import static org.apache.hadoop.hive.metastore.Warehouse.makePartName; -import static org.apache.hadoop.hive.metastore.Warehouse.DEFAULT_CATALOG_NAME; import static org.apache.hadoop.hive.metastore.Warehouse.makeSpecFromName; +import static org.apache.hadoop.hive.metastore.Warehouse.makeValsFromName; +import static org.apache.hadoop.hive.metastore.Warehouse.DEFAULT_CATALOG_NAME; import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.compareFieldColumns; import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.getColumnNamesForTable; import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.getDefaultCatalog; @@ -1065,27 +1071,18 @@ public Partition getPartition(String catName, String dbName, String tblName, * @param maxParts maximum number of partitions to fetch, or -1 for all */ @Override - public List listPartitionsWithAuthInfo(String dbName, - String tableName, List partialPvals, short maxParts, String userName, + public List listPartitionsWithAuthInfo(String catName, String dbName, + String tableName, List partialPvals, int maxParts, String userName, List groupNames) throws TException { org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName, tableName); if (table == null) { //(assume) not a temp table - Try underlying client - return super.listPartitionsWithAuthInfo(dbName, tableName, partialPvals, maxParts, userName, + return super.listPartitionsWithAuthInfo(catName, dbName, tableName, partialPvals, maxParts, userName, groupNames); } TempTable tt = getPartitionedTempTable(table); List parts = tt.listPartitionsByPartitionValsWithAuthInfo(partialPvals, userName, groupNames); - if (parts.isEmpty()) { - throw new NoSuchObjectException("Partition with partition values " + - (partialPvals != null ? Arrays.toString(partialPvals.toArray()) : "null") + - " for table " + tableName + " in database " + dbName + " is not found"); - } - List matchedParts = new ArrayList<>(); - for(int i = 0; i < ((maxParts < 0 || maxParts > parts.size()) ? parts.size() : maxParts); i++) { - matchedParts.add(deepCopy(parts.get(i))); - } - return matchedParts; + return getPartitionsForMaxParts(tableName, parts, maxParts); } @Override @@ -1098,17 +1095,7 @@ public Partition getPartition(String catName, String dbName, String tblName, } TempTable tt = getPartitionedTempTable(table); List partitions = tt.listPartitionsWithAuthInfo(userName, groupNames); - if (partitions.isEmpty()) { - throw new NoSuchObjectException( - "Partition for table " + tableName + " in database " + dbName + "and for user " + - userName + " and group names " + (groupNames != null ? Arrays.toString(groupNames.toArray()) : "null") + - " is not found."); - } - List matchedParts = new ArrayList<>(); - for(int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) { - matchedParts.add(deepCopy(partitions.get(i))); - } - return matchedParts; + return getPartitionsForMaxParts(tableName, partitions, maxParts); } @Override @@ -1124,6 +1111,7 @@ public Partition getPartition(String catName, String dbName, String tblName, for (int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) { result.add(makePartName(table.getPartitionKeys(), partitions.get(i).getValues())); } + Collections.sort(result); return result; } @@ -1140,6 +1128,7 @@ public Partition getPartition(String catName, String dbName, String tblName, for (int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) { result.add(makePartName(table.getPartitionKeys(), partitions.get(i).getValues())); } + Collections.sort(result); return result; } @@ -1151,12 +1140,7 @@ public Partition getPartition(String catName, String dbName, String tblName, return super.listPartitions(catName, dbName, tblName, maxParts); } TempTable tt = getPartitionedTempTable(table); - List partitions = tt.listPartitions(); - List matchedParts = new ArrayList<>(); - for(int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) { - matchedParts.add(deepCopy(partitions.get(i))); - } - return matchedParts; + return getPartitionsForMaxParts(tblName, tt.listPartitions(), maxParts); } @Override @@ -1167,12 +1151,7 @@ public Partition getPartition(String catName, String dbName, String tblName, return super.listPartitions(catName, dbName, tblName, partVals, maxParts); } TempTable tt = getPartitionedTempTable(table); - List partitions = tt.getPartitionsByPartitionVals(partVals); - List matchedParts = new ArrayList<>(); - for(int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) { - matchedParts.add(deepCopy(partitions.get(i))); - } - return matchedParts; + return getPartitionsForMaxParts(tblName, tt.getPartitionsByPartitionVals(partVals), maxParts); } @Override @@ -1183,25 +1162,20 @@ public PartitionSpecProxy listPartitionSpecs(String catName, String dbName, Stri return super.listPartitionSpecs(catName, dbName, tableName, maxParts); } TempTable tt = getPartitionedTempTable(table); - List partitions = tt.listPartitions(); - if (partitions.isEmpty()) { - throw new NoSuchObjectException("Partition for table " + tableName + " in database " + - dbName + " is not found."); - } - List partitionSpecs; - PartitionSpec partitionSpec = new PartitionSpec(); - PartitionListComposingSpec partitionListComposingSpec = new PartitionListComposingSpec(new ArrayList<>()); - for (int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) { - partitionListComposingSpec.addToPartitions(deepCopy(partitions.get(i))); - } - partitionSpec.setCatName(catName); - partitionSpec.setDbName(dbName); - partitionSpec.setTableName(tableName); - partitionSpec.setRootPath(table.getSd().getLocation()); - partitionSpec.setPartitionList(partitionListComposingSpec); - partitionSpecs = Arrays.asList(partitionSpec); + return getPartitionSpecProxy(table, tt.listPartitions(), maxParts); + } - return PartitionSpecProxy.Factory.get(partitionSpecs); + @Override + public boolean listPartitionsByExpr(String catName, String dbName, String tblName, byte[] expr, + String defaultPartitionName, int maxParts, List result) throws TException { + org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName, tblName); + if (table == null) { + return super.listPartitionsByExpr(catName, dbName, tblName, expr, defaultPartitionName, maxParts, result); + } + assert result != null; + result.addAll(getPartitionsForMaxParts(tblName, getPartitionedTempTable(table).listPartitionsByFilter( + generateJDOFilter(table, expr, defaultPartitionName)), maxParts)); + return result.isEmpty(); } @Override @@ -1213,7 +1187,6 @@ public PartitionSpecProxy listPartitionSpecs(String catName, String dbName, Stri return super.getPartitionsByNames(catName, dbName, tblName, partNames, getColStats, engine); } TempTable tt = getPartitionedTempTable(table); - List partitions = tt.getPartitionsByNames(partNames); return deepCopyPartitions(partitions); @@ -1252,7 +1225,6 @@ public boolean dropPartition(String catName, String dbName, String tblName, List if (table == null) { return super.dropPartition(catName, dbName, tblName, partVals, options); } - assertTempTablePartitioned(table); if (partVals == null || partVals.isEmpty() || partVals.contains(null)) { throw new MetaException("Partition values cannot be null, empty or contain null values"); } @@ -1262,13 +1234,8 @@ public boolean dropPartition(String catName, String dbName, String tblName, List } Partition droppedPartition = tt.dropPartition(partVals); boolean result = droppedPartition != null ? true : false; - boolean purgeData = true; - boolean deleteData = true; - if (options != null) { - deleteData = options.deleteData; - purgeData = options.purgeData; - } - + boolean purgeData = options != null ? options.purgeData : true; + boolean deleteData = options != null ? options.deleteData : true; if (deleteData && !tt.isExternal()) { result &= deletePartitionLocation(droppedPartition, purgeData); } @@ -1284,9 +1251,6 @@ public boolean dropPartition(String catName, String dbName, String tableName, St return super.dropPartition(catName, dbName, tableName, partitionName, deleteData); } TempTable tt = getPartitionedTempTable(table); - if (tt == null) { - throw new IllegalStateException("TempTable not found for " + getCatalogQualifiedTableName(table)); - } Partition droppedPartition = tt.dropPartition(partitionName); boolean result = droppedPartition != null ? true : false; if (deleteData && !tt.isExternal()) { @@ -1302,8 +1266,25 @@ public boolean dropPartition(String catName, String dbName, String tableName, St if (table == null) { return super.dropPartitions(catName, dbName, tblName, partExprs, options); } - throw new UnsupportedOperationException("Dropping partitions for temporary tables, using an expression is not" - + "supported"); + TempTable tt = getPartitionedTempTable(table); + List result = new ArrayList<>(); + for (Pair pair : partExprs) { + byte[] expr = pair.getRight(); + String filter = generateJDOFilter(table, expr, conf.get(HiveConf.ConfVars.DEFAULTPARTITIONNAME.varname)); + List partitions = tt.listPartitionsByFilter(filter); + for (Partition p : partitions) { + Partition droppedPartition = tt.dropPartition(p.getValues()); + if (droppedPartition != null) { + result.add(droppedPartition); + boolean purgeData = options != null ? options.purgeData : true; + boolean deleteData = options != null ? options.deleteData : true; + if (deleteData && !tt.isExternal()) { + deletePartitionLocation(droppedPartition, purgeData); + } + } + } + } + return result; } @Override @@ -1430,6 +1411,134 @@ public Partition appendPartition(String catName, String dbName, String tableName return appendPartitionToTempTable(table, partition); } + @Override + public List listPartitionsByFilter(String catName, String dbName, String tableName, + String filter, int maxParts) throws TException { + org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName, tableName); + if (table == null) { + return super.listPartitionsByFilter(catName, dbName, tableName, filter, maxParts); + } + return getPartitionsForMaxParts(tableName, getPartitionedTempTable(table).listPartitionsByFilter( + generateJDOFilter(table, filter)), maxParts); + } + + @Override + public int getNumPartitionsByFilter(String catName, String dbName, String tableName, String filter) + throws TException { + org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName, tableName); + if (table == null) { + return super.getNumPartitionsByFilter(catName, dbName, tableName, filter); + } + return getPartitionedTempTable(table).getNumPartitionsByFilter(generateJDOFilter(table, filter)); + } + + @Override + public PartitionSpecProxy listPartitionSpecsByFilter(String catName, String dbName, String tblName, + String filter, int maxParts) throws TException { + org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName, tblName); + if (table == null) { + return super.listPartitionSpecsByFilter(catName, dbName, tblName, filter, maxParts); + } + return getPartitionSpecProxy(table, getPartitionedTempTable(table).listPartitionsByFilter(generateJDOFilter(table, + filter)), maxParts); + } + + @Override + public PartitionValuesResponse listPartitionValues(PartitionValuesRequest request) throws TException { + if (request == null || request.getPartitionKeys() == null || request.getPartitionKeys().isEmpty()) { + return super.listPartitionValues(request); + } + org.apache.hadoop.hive.metastore.api.Table table = getTempTable(request.getDbName(), request.getTblName()); + if (table == null) { + return super.listPartitionValues(request); + } + TempTable tt = getPartitionedTempTable(table); + List partitions = request.isSetFilter() ? + tt.listPartitionsByFilter(generateJDOFilter(table, request.getFilter())) : + tt.listPartitions(); + List partitionNames = new ArrayList<>(); + for (Partition p : partitions) { + partitionNames.add(makePartName(table.getPartitionKeys(), p.getValues())); + } + if (partitionNames.isEmpty() && partitions.isEmpty()) { + throw new MetaException("Cannot obtain list of partition by filter:\"" + request.getFilter() + + "\" for " + getCatalogQualifiedTableName(table)); + } + if (request.isSetAscending()) { + if (request.isAscending()) { + Collections.sort(partitionNames); + } else { + Collections.sort(partitionNames, Collections.reverseOrder()); + } + } + PartitionValuesResponse response = new PartitionValuesResponse(); + response.setPartitionValues(new ArrayList<>(partitionNames.size())); + for (String partName : partitionNames) { + ArrayList vals = new ArrayList<>(Collections.nCopies(table.getPartitionKeysSize(), null)); + PartitionValuesRow row = new PartitionValuesRow(); + makeValsFromName(partName, vals); + vals.forEach(row::addToRow); + response.addToPartitionValues(row); + } + return response; + } + + private PartitionSpecProxy getPartitionSpecProxy(org.apache.hadoop.hive.metastore.api.Table table, + List partitions, int maxParts) throws MetaException { + List partitionSpecs; + PartitionSpec partitionSpec = new PartitionSpec(); + PartitionListComposingSpec partitionListComposingSpec = new PartitionListComposingSpec(new ArrayList<>()); + for (int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) { + partitionListComposingSpec.addToPartitions(deepCopy(partitions.get(i))); + } + partitionSpec.setCatName(table.getCatName()); + partitionSpec.setDbName(table.getDbName()); + partitionSpec.setTableName(table.getTableName()); + partitionSpec.setRootPath(table.getSd().getLocation()); + partitionSpec.setPartitionList(partitionListComposingSpec); + partitionSpecs = Arrays.asList(partitionSpec); + + return PartitionSpecProxy.Factory.get(partitionSpecs); + } + + private List getPartitionsForMaxParts(String tableName, List parts, int maxParts) { + List matchedParts = new ArrayList<>(); + for(int i = 0; i < ((maxParts < 0 || maxParts > parts.size()) ? parts.size() : maxParts); i++) { + matchedParts.add(deepCopy(parts.get(i))); + } + return matchedParts; + } + + private String generateJDOFilter(org.apache.hadoop.hive.metastore.api.Table table, String filter) + throws MetaException { + ExpressionTree exprTree = org.apache.commons.lang.StringUtils.isNotEmpty(filter) + ? PartFilterExprUtil.getFilterParser(filter).tree : ExpressionTree.EMPTY_TREE; + return generateJDOFilter(table, exprTree); + } + + private String generateJDOFilter(org.apache.hadoop.hive.metastore.api.Table table, byte[] expr, + String defaultPartitionName) throws MetaException { + ExpressionTree expressionTree = PartFilterExprUtil + .makeExpressionTree(PartFilterExprUtil.createExpressionProxy(conf), expr, defaultPartitionName); + return generateJDOFilter(table, expressionTree == null ? ExpressionTree.EMPTY_TREE : expressionTree); + } + + private String generateJDOFilter(org.apache.hadoop.hive.metastore.api.Table table, ExpressionTree exprTree) + throws MetaException { + + ExpressionTree.FilterBuilder filterBuilder = new ExpressionTree.FilterBuilder(true); + Map params = new HashMap<>(); + exprTree.generateJDOFilterFragment(conf, table, params, filterBuilder); + StringBuilder stringBuilder = new StringBuilder(filterBuilder.getFilter()); + // replace leading && + stringBuilder.replace(0, 4, ""); + params.entrySet().stream().forEach(e -> { + int index = stringBuilder.indexOf(e.getKey()); + stringBuilder.replace(index, index + e.getKey().length(), "\"" + e.getValue().toString() + "\""); + }); + return stringBuilder.toString(); + } + private Partition appendPartitionToTempTable(org.apache.hadoop.hive.metastore.api.Table table, Partition partition) throws MetaException, AlreadyExistsException { TempTable tt = getPartitionedTempTable(table); @@ -1661,6 +1770,9 @@ private Path getPartitionLocation(org.apache.hadoop.hive.metastore.api.Table tab } org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName, tableName); TempTable tt = getPartitionedTempTable(table); + if (tt == null) { + throw new IllegalStateException("TempTable not found for " + getCatalogQualifiedTableName(table)); + } List result = tt.addPartitions(deepCopyPartitions(partitions), ifNotExists); for (Partition p : result) { createAndSetLocationForAddedPartition(p, getPartitionLocation(table, p, false)); diff --git ql/src/java/org/apache/hadoop/hive/ql/metadata/TempTable.java ql/src/java/org/apache/hadoop/hive/ql/metadata/TempTable.java index e659b5407d..2c178eaa7a 100644 --- ql/src/java/org/apache/hadoop/hive/ql/metadata/TempTable.java +++ ql/src/java/org/apache/hadoop/hive/ql/metadata/TempTable.java @@ -132,7 +132,10 @@ Partition getPartitionWithAuthInfo(List partionVals, String userName, Li } private boolean checkPrivilegesForPartition(Partition partition, String userName, List groupNames) { - if ((userName == null || userName.isEmpty()) && (groupNames == null || groupNames.isEmpty())) { + if (userName == null || userName.isEmpty()) { + return true; + } + if (groupNames == null || groupNames.isEmpty()) { return true; } PrincipalPrivilegeSet privileges = partition.getPrivileges(); @@ -145,9 +148,6 @@ private boolean checkPrivilegesForPartition(Partition partition, String userName } } if (privileges.isSetGroupPrivileges()) { - if (groupNames == null) { - return false; - } for (String group : groupNames) { if (!privileges.getGroupPrivileges().containsKey(group)) { return false; @@ -192,4 +192,12 @@ void renamePartition(List partitionVals, Partition newPart) pTree.renamePartition(partitionVals, newPart); } + int getNumPartitionsByFilter(String filter) throws MetaException { + return pTree.getPartitionsByFilter(filter).size(); + } + + List listPartitionsByFilter(String filter) throws MetaException { + return pTree.getPartitionsByFilter(filter); + } + } diff --git ql/src/test/org/apache/hadoop/hive/metastore/TestMetastoreExpr.java ql/src/test/org/apache/hadoop/hive/metastore/TestMetastoreExpr.java index c861107ecb..6b1092029a 100644 --- ql/src/test/org/apache/hadoop/hive/metastore/TestMetastoreExpr.java +++ ql/src/test/org/apache/hadoop/hive/metastore/TestMetastoreExpr.java @@ -183,7 +183,10 @@ public void checkExpr(int numParts, assertEquals("Partition check failed: " + expr.getExprString(), numParts, parts.size()); } - private static class ExprBuilder { + /** + * Helper class for building an expression. + */ + public static class ExprBuilder { private final String tblName; private final Stack stack = new Stack(); diff --git ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientGetPartitionsTempTable.java ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientGetPartitionsTempTable.java index d35621a9c2..22b21b8abd 100644 --- ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientGetPartitionsTempTable.java +++ ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientGetPartitionsTempTable.java @@ -27,7 +27,6 @@ import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet; import org.apache.hadoop.hive.metastore.api.PrivilegeGrantInfo; import org.apache.hadoop.hive.metastore.api.MetaException; -import org.apache.hadoop.hive.metastore.api.NoSuchObjectException; import org.apache.hadoop.hive.metastore.client.CustomIgnoreRule; import org.apache.hadoop.hive.metastore.client.TestGetPartitions; import org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder; @@ -171,13 +170,6 @@ public void testGetPartitionWithAuthInfoNullTblName() super.testGetPartitionWithAuthInfoNullTblName(); } - @Test(expected = NoSuchObjectException.class) - @Override - public void testGetPartitionWithAuthInfoNullGroups() - throws Exception { - super.testGetPartitionWithAuthInfoNullGroups(); - } - private void assertAuthInfoReturned(String userName, List groups, Partition partition) { PrincipalPrivilegeSet privileges = partition.getPrivileges(); assertNotNull(privileges); diff --git ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientListPartitionsTempTable.java ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientListPartitionsTempTable.java index a74b543faa..64f7a32ec7 100644 --- ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientListPartitionsTempTable.java +++ ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientListPartitionsTempTable.java @@ -18,9 +18,9 @@ package org.apache.hadoop.hive.ql.metadata; -import com.google.common.collect.Lists; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.IMetaStoreClient; +import org.apache.hadoop.hive.metastore.TestMetastoreExpr; import org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest; import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.NoSuchObjectException; @@ -33,7 +33,8 @@ import org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder; import org.apache.hadoop.hive.metastore.client.builder.TableBuilder; import org.apache.hadoop.hive.metastore.minihms.AbstractMetaStoreService; -import org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy; +import org.apache.hadoop.hive.ql.exec.SerializationUtilities; +import org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc; import org.apache.hadoop.hive.ql.session.SessionState; import org.apache.thrift.TException; import org.junit.Before; @@ -47,7 +48,6 @@ import java.util.List; import java.util.Map; -import static junit.framework.TestCase.assertFalse; import static junit.framework.TestCase.assertTrue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -128,14 +128,6 @@ protected void assertAuthInfoReturned(String userName, String group, Partition p assertTrue(privileges.getGroupPrivileges().containsKey(group)); } - @Test - @Override - public void testListPartitionsAllHighMaxParts() throws Exception { - List> testData = createTable4PartColsParts(getClient()); - List partitions = getClient().listPartitions(DB_NAME, TABLE_NAME, (short) 101); - assertFalse(partitions.isEmpty()); - assertEquals(testData.size(), partitions.size()); - } @Test(expected = MetaException.class) @Override @@ -149,14 +141,6 @@ public void testListPartitionsAllNullDbName() throws Exception { super.testListPartitionsAllNullDbName(); } - @Test - @Override - public void testListPartitionSpecsHighMaxParts() throws Exception { - List> testValues = createTable4PartColsParts(getClient()); - PartitionSpecProxy partitionSpecs = getClient().listPartitionSpecs(DB_NAME, TABLE_NAME, 101); - assertNotNull(partitionSpecs); - assertPartitionsSpecProxy(partitionSpecs, testValues); - } @Test(expected = MetaException.class) @Override @@ -164,29 +148,6 @@ public void testListPartitionSpecsNullTblName() throws Exception { super.testListPartitionSpecsNullTblName(); } - @Test - @Override - public void testListPartitionsWithAuthHighMaxParts() throws Exception { - createTable4PartColsPartsAuthOn(getClient()); - List partitions = - getClient().listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, (short) 101, USER_NAME, Lists.newArrayList(GROUP)); - partitions.forEach(p -> assertAuthInfoReturned(USER_NAME, GROUP, p)); - } - - @Test(expected = NoSuchObjectException.class) - @Override - public void testListPartitionsWithAuthNullGroup() - throws Exception { - super.testListPartitionsWithAuthNullGroup(); - } - - @Test(expected = NoSuchObjectException.class) - @Override - public void testListPartitionsWithAuthByValues() - throws Exception { - super.testListPartitionsWithAuthByValues(); - } - @Test(expected = MetaException.class) @Override public void testListPartitionsWithAuthByValuesNullDbName() @@ -227,10 +188,116 @@ public void testListPartitionNamesByValuesNullTblName() super.testListPartitionNamesByValuesNullTblName(); } - @Test + @Test(expected = MetaException.class) + @Override + public void testListPartitionsByFilterNullTblName() throws Exception { + super.testListPartitionsByFilterNullTblName(); + } + + @Test(expected = MetaException.class) + @Override + public void testListPartitionsByFilterNullDbName() throws Exception { + super.testListPartitionsByFilterNullDbName(); + } + + @Test(expected = MetaException.class) @Override - public void testListPartitionsWithAuthNoTable() throws Exception { - getClient().listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, (short)-1, "", Lists.newArrayList()); + public void testListPartitionValuesNullDbName() throws Exception { + super.testListPartitionValuesNullDbName(); + } + + @Test(expected = MetaException.class) + @Override + public void testListPartitionValuesNullTblName() throws Exception { + super.testListPartitionValuesNullTblName(); + } + + @Test + public void testListPartitionsByExpr() throws Exception { + createTable4PartColsParts(getClient()); + TestMetastoreExpr.ExprBuilder e = new TestMetastoreExpr.ExprBuilder(TABLE_NAME); + checkExpr(2, e.strCol("yyyy").val("2017").pred("=", 2).build()); + checkExpr(3, e.strCol("mm").val("11").pred(">", 2).build()); + checkExpr(4, e.strCol("dd").val("29").pred(">=", 2).build()); + checkExpr(2, e.strCol("yyyy").val("2017").pred("!=", 2).build()); + checkExpr(1, e.strCol("yyyy").val("2017").pred("=", 2) + .strCol("mm").val("10").pred(">=", 2).pred("and", 2).build()); + checkExpr(3, e.strCol("dd").val("10").pred("<", 2).strCol("yyyy") + .val("2009").pred("!=", 2).pred("or", 2).build()); + checkExpr(0, e.strCol("yyyy").val("2019").pred("=", 2).build()); + } + + @Test(expected = AssertionError.class) + public void testListPartitionsByExprNullResult() throws Exception { + createTable4PartColsParts(getClient()); + TestMetastoreExpr.ExprBuilder e = new TestMetastoreExpr.ExprBuilder(TABLE_NAME); + getClient().listPartitionsByExpr(DB_NAME, TABLE_NAME, SerializationUtilities.serializeExpressionToKryo( + e.strCol("yyyy").val("2017").pred("=", 2).build()), null, (short)-1, null); + } + + @Test + public void testListPartitionsByExprDefMaxParts() throws Exception { + createTable4PartColsParts(getClient()); + TestMetastoreExpr.ExprBuilder e = new TestMetastoreExpr.ExprBuilder(TABLE_NAME); + List result = new ArrayList<>(); + getClient().listPartitionsByExpr(DB_NAME, TABLE_NAME, SerializationUtilities.serializeExpressionToKryo( + e.strCol("yyyy").val("2017").pred(">=", 2).build()), null, (short)3, result); + assertEquals(3, result.size()); + } + + @Test + public void testListPartitionsByExprHighMaxParts() throws Exception { + createTable4PartColsParts(getClient()); + TestMetastoreExpr.ExprBuilder e = new TestMetastoreExpr.ExprBuilder(TABLE_NAME); + List result = new ArrayList<>(); + getClient().listPartitionsByExpr(DB_NAME, TABLE_NAME, SerializationUtilities.serializeExpressionToKryo( + e.strCol("yyyy").val("2017").pred(">=", 2).build()), null, (short)100, result); + assertEquals(4, result.size()); + } + + @Test(expected = NoSuchObjectException.class) + public void testListPartitionsByExprNoDb() throws Exception { + getClient().dropDatabase(DB_NAME); + getClient().listPartitionsByExpr(DB_NAME, TABLE_NAME, new byte[] {'f', 'o', 'o'}, + null, (short)-1, new ArrayList<>()); + } + + @Test(expected = NoSuchObjectException.class) + public void testListPartitionsByExprNoTbl() throws Exception { + getClient().listPartitionsByExpr(DB_NAME, TABLE_NAME, new byte[] {'f', 'o', 'o'}, + null, (short)-1, new ArrayList<>()); + } + + @Test(expected = NoSuchObjectException.class) + public void testListPartitionsByExprEmptyDbName() throws Exception { + getClient().listPartitionsByExpr("", TABLE_NAME, new byte[] {'f', 'o', 'o'}, + null, (short)-1, new ArrayList<>()); + } + + @Test(expected = NoSuchObjectException.class) + public void testListPartitionsByExprEmptyTblName() throws Exception { + createTable3PartCols1Part(getClient()); + getClient().listPartitionsByExpr(DB_NAME, "", new byte[] {'f', 'o', 'o'}, + null, (short)-1, new ArrayList<>()); + } + + @Test(expected = MetaException.class) + public void testListPartitionsByExprNullDbName() throws Exception { + getClient().listPartitionsByExpr(null, TABLE_NAME, new byte[] {'f', 'o', 'o'}, + null, (short)-1, new ArrayList<>()); + } + + @Test(expected = MetaException.class) + public void testListPartitionsByExprNullTblName() throws Exception { + getClient().listPartitionsByExpr(DB_NAME, null, new byte[] {'f', 'o', 'o' }, + null, (short)-1, new ArrayList<>()); + } + + private void checkExpr(int numParts, ExprNodeGenericFuncDesc expr) throws Exception { + List parts = new ArrayList<>(); + getClient().listPartitionsByExpr(DB_NAME, TABLE_NAME, SerializationUtilities.serializeExpressionToKryo(expr), + null, (short) -1, parts); + assertEquals("Partition check failed: " + expr.getExprString(), numParts, parts.size()); } } diff --git standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java index 94d37c220f..8d0c095220 100644 --- standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java +++ standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java @@ -282,6 +282,7 @@ public void testListPartitionsAll() throws Exception { } @Test(expected = MetaException.class) + @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsAllHighMaxParts() throws Exception { createTable3PartCols1Part(client); List partitions = client.listPartitions(DB_NAME, TABLE_NAME, (short)101); @@ -451,6 +452,7 @@ public void testListPartitionSpecsNoDb() throws Exception { } @Test(expected = MetaException.class) + @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionSpecsHighMaxParts() throws Exception { createTable4PartColsParts(client); client.listPartitionSpecs(DB_NAME, TABLE_NAME, 101); @@ -514,6 +516,7 @@ public void testListPartitionsWithAuth() throws Exception { } @Test(expected = MetaException.class) + @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsWithAuthHighMaxParts() throws Exception { createTable4PartColsParts(client); client.listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, (short)101, "", Lists.newArrayList()); @@ -556,6 +559,7 @@ public void testListPartitionsWithAuthNoTblName() throws Exception { } @Test(expected = NoSuchObjectException.class) + @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsWithAuthNoTable() throws Exception { client.listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, (short)-1, "", Lists.newArrayList()); } @@ -757,7 +761,6 @@ public void testListPartitionsWithAuthByValuesNullGroup() throws Exception { */ @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsByFilter() throws Exception { List> partValues = createTable4PartColsParts(client); List partitions = client.listPartitionsByFilter(DB_NAME, TABLE_NAME, @@ -780,7 +783,6 @@ public void testListPartitionsByFilter() throws Exception { } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsByFilterCaseInsensitive() throws Exception { String tableName = TABLE_NAME + "_caseinsensitive"; Table t = createTestTable(client, DB_NAME, tableName, @@ -823,7 +825,6 @@ public void testListPartitionsByFilterCaseInsensitive() throws Exception { } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsByFilterCaseSensitive() throws Exception { String tableName = TABLE_NAME + "_casesensitive"; Table t = createTestTable(client, DB_NAME, tableName, @@ -859,7 +860,6 @@ public void testListPartitionsByFilterCaseSensitive() throws Exception { } @Test(expected = MetaException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsByFilterInvalidFilter() throws Exception { createTable4PartColsParts(client); client.listPartitionsByFilter(DB_NAME, TABLE_NAME, "yyy=\"2017\"", (short)101); @@ -873,34 +873,29 @@ public void testListPartitionsByFilterHighMaxParts() throws Exception { } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsByFilterNoTblName() throws Exception { createTable4PartColsParts(client); client.listPartitionsByFilter(DB_NAME, "", "yyyy=\"2017\"", (short)-1); } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsByFilterNoDbName() throws Exception { createTable4PartColsParts(client); client.listPartitionsByFilter("", TABLE_NAME, "yyyy=\"2017\"", (short)-1); } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsByFilterNoTable() throws Exception { client.listPartitionsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\"", (short)-1); } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsByFilterNoDb() throws Exception { client.dropDatabase(DB_NAME); client.listPartitionsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\"", (short)-1); } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsByFilterNullTblName() throws Exception { try { createTable4PartColsParts(client); @@ -912,7 +907,6 @@ public void testListPartitionsByFilterNullTblName() throws Exception { } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsByFilterNullDbName() throws Exception { try { createTable4PartColsParts(client); @@ -924,7 +918,6 @@ public void testListPartitionsByFilterNullDbName() throws Exception { } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsByFilterNullFilter() throws Exception { createTable4PartColsParts(client); List partitions = client.listPartitionsByFilter(DB_NAME, TABLE_NAME, null, @@ -933,7 +926,6 @@ public void testListPartitionsByFilterNullFilter() throws Exception { } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsByFilterEmptyFilter() throws Exception { createTable4PartColsParts(client); List partitions = client.listPartitionsByFilter(DB_NAME, TABLE_NAME, "", (short)-1); @@ -947,7 +939,6 @@ public void testListPartitionsByFilterEmptyFilter() throws Exception { * get_part_specs_by_filter(String,String,String,int). */ @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionsSpecsByFilter() throws Exception { List> testValues = createTable4PartColsParts(client); PartitionSpecProxy partSpecProxy = client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME, @@ -980,7 +971,6 @@ public void testListPartitionsSpecsByFilter() throws Exception { } @Test(expected = MetaException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionSpecsByFilterInvalidFilter() throws Exception { createTable4PartColsParts(client); client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME, "yyy=\"2017\"", 101); @@ -994,48 +984,41 @@ public void testListPartitionSpecsByFilterHighMaxParts() throws Exception { } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionSpecsByFilterNoTblName() throws Exception { createTable4PartColsParts(client); client.listPartitionSpecsByFilter(DB_NAME, "", "yyyy=\"2017\"", -1); } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionSpecsByFilterNoDbName() throws Exception { createTable4PartColsParts(client); client.listPartitionSpecsByFilter("", TABLE_NAME, "yyyy=\"2017\"", -1); } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionSpecsByFilterNoTable() throws Exception { client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\"", -1); } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionSpecsByFilterNoDb() throws Exception { client.dropDatabase(DB_NAME); client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\"", -1); } @Test(expected = MetaException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionSpecsByFilterNullTblName() throws Exception { createTable4PartColsParts(client); client.listPartitionSpecsByFilter(DB_NAME, null, "yyyy=\"2017\"", -1); } @Test(expected = MetaException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionSpecsByFilterNullDbName() throws Exception { createTable4PartColsParts(client); client.listPartitionSpecsByFilter(null, TABLE_NAME, "yyyy=\"2017\"", -1); } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionSpecsByFilterNullFilter() throws Exception { List> values = createTable4PartColsParts(client); PartitionSpecProxy pproxy = client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME, null, -1); @@ -1043,7 +1026,6 @@ public void testListPartitionSpecsByFilterNullFilter() throws Exception { } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionSpecsByFilterEmptyFilter() throws Exception { List> values = createTable4PartColsParts(client); PartitionSpecProxy pproxy = client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME, "", -1); @@ -1057,7 +1039,6 @@ public void testListPartitionSpecsByFilterEmptyFilter() throws Exception { * get_num_partitions_by_filter(String,String,String). */ @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testGetNumPartitionsByFilter() throws Exception { createTable4PartColsParts(client); int n = client.getNumPartitionsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\" OR " + @@ -1082,55 +1063,47 @@ public void testGetNumPartitionsByFilter() throws Exception { } @Test(expected = MetaException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testGetNumPartitionsByFilterInvalidFilter() throws Exception { createTable4PartColsParts(client); client.getNumPartitionsByFilter(DB_NAME, TABLE_NAME, "yyy=\"2017\""); } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testGetNumPartitionsByFilterNoTblName() throws Exception { createTable4PartColsParts(client); client.getNumPartitionsByFilter(DB_NAME, "", "yyyy=\"2017\""); } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testGetNumPartitionsByFilterNoDbName() throws Exception { createTable4PartColsParts(client); client.getNumPartitionsByFilter("", TABLE_NAME, "yyyy=\"2017\""); } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testGetNumPartitionsByFilterNoTable() throws Exception { client.getNumPartitionsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\""); } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testGetNumPartitionsByFilterNoDb() throws Exception { client.dropDatabase(DB_NAME); client.getNumPartitionsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\""); } @Test(expected = MetaException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testGetNumPartitionsByFilterNullTblName() throws Exception { createTable4PartColsParts(client); client.getNumPartitionsByFilter(DB_NAME, null, "yyyy=\"2017\""); } @Test(expected = MetaException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testGetNumPartitionsByFilterNullDbName() throws Exception { createTable4PartColsParts(client); client.getNumPartitionsByFilter(null, TABLE_NAME, "yyyy=\"2017\""); } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testGetNumPartitionsByFilterNullFilter() throws Exception { createTable4PartColsParts(client); int n = client.getNumPartitionsByFilter(DB_NAME, TABLE_NAME, null); @@ -1340,7 +1313,6 @@ public void testListPartitionNamesByValuesNullValues() throws Exception { * get_partition_values(PartitionValuesRequest). */ @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionValues() throws Exception { List> testValues = createTable4PartColsParts(client); List partitionSchema = Lists.newArrayList( @@ -1355,7 +1327,6 @@ public void testListPartitionValues() throws Exception { } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionValuesEmptySchema() throws Exception { try { List> testValues = createTable4PartColsParts(client); @@ -1371,7 +1342,6 @@ public void testListPartitionValuesEmptySchema() throws Exception { } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionValuesNoDbName() throws Exception { createTable4PartColsParts(client); List partitionSchema = Lists.newArrayList( @@ -1384,7 +1354,6 @@ public void testListPartitionValuesNoDbName() throws Exception { } @Test(expected = NoSuchObjectException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionValuesNoTblName() throws Exception { createTable4PartColsParts(client); List partitionSchema = Lists.newArrayList( @@ -1397,7 +1366,6 @@ public void testListPartitionValuesNoTblName() throws Exception { } @Test(expected = MetaException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionValuesNoTable() throws Exception { List partitionSchema = Lists.newArrayList( new FieldSchema("yyyy", "string", ""), @@ -1409,9 +1377,7 @@ public void testListPartitionValuesNoTable() throws Exception { } @Test(expected = MetaException.class) - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionValuesNoDb() throws Exception { - client.dropDatabase(DB_NAME); List partitionSchema = Lists.newArrayList( new FieldSchema("yyyy", "string", ""), new FieldSchema("mm", "string", "")); @@ -1422,7 +1388,6 @@ public void testListPartitionValuesNoDb() throws Exception { } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionValuesNullDbName() throws Exception { try { createTable4PartColsParts(client); @@ -1458,7 +1423,6 @@ public void testListPartitionValuesNullTblName() throws Exception { } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionValuesNullSchema() throws Exception { try { createTable4PartColsParts(client); @@ -1472,7 +1436,6 @@ public void testListPartitionValuesNullSchema() throws Exception { } @Test - @ConditionalIgnoreOnSessionHiveMetastoreClient public void testListPartitionValuesNullRequest() throws Exception { try { createTable4PartColsParts(client);