wsjz commented on code in PR #27835:
URL: https://github.com/apache/doris/pull/27835#discussion_r1418846136
##########
fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java:
##########
@@ -1691,28 +1692,53 @@ private void
handleShowMaxComputeTablePartitions(ShowPartitionsStmt showStmt) {
resultSet = new ShowResultSet(showStmt.getMetaData(), rows);
}
- private void handleShowHMSTablePartitions(ShowPartitionsStmt showStmt) {
+ private void handleShowHMSTablePartitions(ShowPartitionsStmt showStmt)
throws AnalysisException {
HMSExternalCatalog catalog = (HMSExternalCatalog)
(showStmt.getCatalog());
List<List<String>> rows = new ArrayList<>();
String dbName =
ClusterNamespace.getNameFromFullName(showStmt.getTableName().getDb());
List<String> partitionNames;
LimitElement limit = showStmt.getLimitElement();
- if (limit != null && limit.hasLimit()) {
- // only limit is valid on Hive
+ Map<String, Expr> filterMap = showStmt.getFilterMap();
+ List<OrderByPair> orderByPairs = showStmt.getOrderByPairs();
+
+ if (limit != null && limit.hasLimit() && limit.getOffset() == 0
+ && (orderByPairs == null || !orderByPairs.get(0).isDesc())) {
+ // hmsClient returns unordered partition list, hence if offset > 0
cannot pass limit
partitionNames = catalog.getClient()
- .listPartitionNames(dbName,
showStmt.getTableName().getTbl(), limit.getLimit());
+ .listPartitionNames(dbName, showStmt.getTableName().getTbl(),
limit.getLimit());
Review Comment:
The reasons for this change refer to my comments above
```suggestion
.listPartitionNames(dbName,
showStmt.getTableName().getTbl(), limit.getLimit() + limit.getOffset());
```
--
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]