weizhengte commented on code in PR #17966:
URL: https://github.com/apache/doris/pull/17966#discussion_r1144232528


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyzeStmt.java:
##########
@@ -166,46 +150,81 @@ private void checkAnalyzePriv(String dbName, String 
tblName) throws AnalysisExce
     }
 
     private void checkPartitionNames() throws AnalysisException {
-        if (optPartitionNames != null) {
-            optPartitionNames.analyze(analyzer);
-            if (tableName != null) {
-                Database db = 
analyzer.getEnv().getInternalCatalog().getDbOrAnalysisException(tableName.getDb());
-                OlapTable olapTable = (OlapTable) 
db.getTableOrAnalysisException(tableName.getTbl());
-                if (!olapTable.isPartitioned()) {
-                    throw new AnalysisException("Not a partitioned table: " + 
olapTable.getName());
-                }
-                List<String> names = optPartitionNames.getPartitionNames();
-                Set<String> olapPartitionNames = olapTable.getPartitionNames();
-                List<String> tempPartitionNames = 
olapTable.getTempPartitions().stream()
-                        .map(Partition::getName).collect(Collectors.toList());
-                Optional<String> optional = names.stream()
-                        .filter(name -> (tempPartitionNames.contains(name)
-                                || !olapPartitionNames.contains(name)))
-                        .findFirst();
-                if (optional.isPresent()) {
-                    throw new AnalysisException("Temporary partition or 
partition does not exist");
-                }
-            } else {
-                throw new AnalysisException("Specify partition should specify 
table name as well");
+        if (partitionNames != null) {
+            partitionNames.analyze(analyzer);
+            Database db = analyzer.getEnv().getInternalCatalog()
+                    .getDbOrAnalysisException(tableName.getDb());
+            OlapTable olapTable = (OlapTable) 
db.getTableOrAnalysisException(tableName.getTbl());
+            if (!olapTable.isPartitioned()) {
+                throw new AnalysisException("Not a partitioned table: " + 
olapTable.getName());
+            }
+            List<String> names = partitionNames.getPartitionNames();
+            Set<String> olapPartitionNames = olapTable.getPartitionNames();
+            List<String> tempPartitionNames = 
olapTable.getTempPartitions().stream()
+                    .map(Partition::getName).collect(Collectors.toList());
+            Optional<String> optional = names.stream()
+                    .filter(name -> (tempPartitionNames.contains(name)
+                            || !olapPartitionNames.contains(name)))
+                    .findFirst();
+            if (optional.isPresent()) {
+                throw new AnalysisException("Temporary partition or partition 
does not exist");

Review Comment:
   This is because of the variable name, making it look a little weird. Changed 
the variable name.



##########
fe/fe-core/src/main/java/org/apache/doris/statistics/AnalysisTaskInfo.java:
##########
@@ -62,6 +63,8 @@ public enum ScheduleType {
 
     public final String colName;
 
+    public final List<String> partitionNames;

Review Comment:
   Sure



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to