Yulei-Yang commented on code in PR #19242:
URL: https://github.com/apache/doris/pull/19242#discussion_r1186664644


##########
fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java:
##########
@@ -1567,10 +1570,42 @@ private void handleShowData() throws AnalysisException {
 
     private void handleShowPartitions() throws AnalysisException {
         ShowPartitionsStmt showStmt = (ShowPartitionsStmt) stmt;
-        ProcNodeInterface procNodeI = showStmt.getNode();
-        Preconditions.checkNotNull(procNodeI);
-        List<List<String>> rows = ((PartitionsProcDir) 
procNodeI).fetchResultByFilter(showStmt.getFilterMap(),
-                showStmt.getOrderByPairs(), 
showStmt.getLimitElement()).getRows();
+        if (showStmt.getCatalog().isInternalCatalog()) {
+            ProcNodeInterface procNodeI = showStmt.getNode();
+            Preconditions.checkNotNull(procNodeI);
+            List<List<String>> rows = ((PartitionsProcDir) 
procNodeI).fetchResultByFilter(showStmt.getFilterMap(),
+                    showStmt.getOrderByPairs(), 
showStmt.getLimitElement()).getRows();
+            resultSet = new ShowResultSet(showStmt.getMetaData(), rows);
+        } else {
+            handleShowHMSTablePartitions(showStmt);
+        }
+    }
+
+    private void handleShowHMSTablePartitions(ShowPartitionsStmt showStmt) 
throws AnalysisException {
+        CatalogIf catalog = showStmt.getCatalog();
+        DatabaseIf database = 
catalog.getDbOrAnalysisException(showStmt.getTableName().getDb());
+        HMSExternalTable hmsTable = (HMSExternalTable) 
database.getTableNullable(showStmt.getTableName().getTbl());
+        List<Type> partitionColumnTypes = hmsTable.getPartitionColumnTypes();
+
+        List<List<String>> rows = new ArrayList<>();
+        HiveMetaStoreCache cache = Env.getCurrentEnv().getExtMetaCacheMgr()
+                .getMetaStoreCache((HMSExternalCatalog) catalog);
+        if (!partitionColumnTypes.isEmpty()) {
+            HiveMetaStoreCache.HivePartitionValues hivePartitionValues =
+                    cache.getPartitionValues(hmsTable.getDbName(), 
hmsTable.getName(), partitionColumnTypes);

Review Comment:
   fixed



-- 
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]

Reply via email to