dengzhhu653 commented on code in PR #5198:
URL: https://github.com/apache/hive/pull/5198#discussion_r1581999728
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java:
##########
@@ -3466,11 +3467,49 @@ protected List<String> getJdoResult(
}.run(true);
}
- private List<String> getPartitionNamesViaOrm(Table table, ExpressionTree
tree, String order,
- Integer maxParts, boolean isValidatedFilter) throws MetaException {
+ @Override
+ public List<String> listPartitionNamesByFilter(String catName, String
dbName, String tblName,
+ GetPartitionsArgs args) throws MetaException, NoSuchObjectException {
+
+ catName = normalizeIdentifier(catName);
+ dbName = normalizeIdentifier(dbName);
+ tblName = normalizeIdentifier(tblName);
+
+ MTable mTable = ensureGetMTable(catName, dbName, tblName);
+ List<FieldSchema> partitionKeys =
convertToFieldSchemas(mTable.getPartitionKeys());
+ String filter = args.getFilter();
+ final ExpressionTree tree = (filter != null && !filter.isEmpty())
+ ? PartFilterExprUtil.parseFilterTree(filter) :
ExpressionTree.EMPTY_TREE;
+ return new GetListHelper<String>(catName, dbName, tblName, true, true) {
+ private final SqlFilterForPushdown filter = new SqlFilterForPushdown();
+
+ @Override
+ protected boolean canUseDirectSql(GetHelper<List<String>> ctx) throws
MetaException {
+ return directSql.generateSqlFilterForPushdown(catName, dbName, tblName,
+ partitionKeys, tree, null, filter);
+ }
+
+ @Override
+ protected List<String> getSqlResult(GetHelper<List<String>> ctx) throws
MetaException {
+ return directSql.getPartitionNamesViaSql(filter, partitionKeys,
+ getDefaultPartitionName(args.getDefaultPartName()), null,
args.getMax());
+ }
+
+ @Override
+ protected List<String> getJdoResult(GetHelper<List<String>> ctx)
+ throws MetaException, NoSuchObjectException, InvalidObjectException {
+ return getPartitionNamesViaOrm(catName, dbName, tblName, tree, null,
Review Comment:
what if the `getPartitionNamesViaOrm` returns null, should we throw a
message to indicate there is an error in generating the filter?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]