morningman commented on code in PR #13883:
URL: https://github.com/apache/doris/pull/13883#discussion_r1019807221


##########
fe/fe-core/src/main/java/org/apache/doris/persist/AnalysisJobScheduler.java:
##########
@@ -0,0 +1,136 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.persist;
+
+import org.apache.doris.statistics.AnalysisJob;
+import org.apache.doris.statistics.AnalysisJobExecutor;
+import org.apache.doris.statistics.AnalysisJobInfo;
+import org.apache.doris.statistics.AnalysisJobInfo.JobState;
+import org.apache.doris.statistics.AnalysisJobInfo.JobType;
+import org.apache.doris.statistics.StatisticConstants;
+import org.apache.doris.statistics.StatisticsUtil;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.text.StringSubstitutor;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.PriorityQueue;
+import java.util.Queue;
+import java.util.Set;
+
+public class AnalysisJobScheduler {

Review Comment:
   Move the `AnalysisJobScheduler` to `statistics` package



##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -581,7 +583,7 @@ public void execute(TUniqueId queryId) throws Exception {
             throw e;
         } catch (UserException e) {
             // analysis exception only print message, not print the stack
-            LOG.warn("execute Exception. {}, {}", 
context.getQueryIdentifier(), e.getMessage());
+            LOG.warn("execute Exception. {}, {}", 
context.getQueryIdentifier(), e.getMessage(), e);

Review Comment:
   Do not print stack trace here.



##########
fe/fe-core/src/main/java/org/apache/doris/persist/StaleStatisticsRecordsDetector.java:
##########
@@ -0,0 +1,69 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.persist;
+
+import org.apache.doris.catalog.Env;
+import org.apache.doris.common.Config;
+import org.apache.doris.common.util.MasterDaemon;
+import org.apache.doris.statistics.AnalysisJobInfo;
+import org.apache.doris.statistics.StatisticConstants;
+import org.apache.doris.statistics.StatisticsUtil;
+import org.apache.doris.statistics.util.InternalQueryResult.ResultRow;
+
+import org.apache.commons.text.StringSubstitutor;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.thrift.TException;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class StaleStatisticsRecordsDetector extends MasterDaemon {

Review Comment:
   Move to `statistics` package



##########
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java:
##########
@@ -583,6 +585,9 @@ public class SessionVariable implements Serializable, 
Writable {
     @VariableMgr.VarAttr(name = ENABLE_NEREIDS_STATS_DERIVE_V2)
     public boolean enableNereidsStatsDeriveV2 = false;
 
+    @VariableMgr.VarAttr(name = INTERNAL_SESSION)
+    public boolean internalSession = false;

Review Comment:
   What does internal session mean?
   I think we should not expose this variable.



##########
fe/fe-core/src/main/java/org/apache/doris/common/Config.java:
##########
@@ -1832,6 +1832,48 @@ public class Config extends ConfigBase {
     @ConfField(mutable = true, masterOnly = false)
     public static long hive_metastore_client_timeout_second = 10;
 
+    @ConfField(mutable = false)
+    public static int statistic_table_bucket_count = 7;
+
+    @ConfField
+    public static long statistics_max_mem_per_query_in_bytes = 2L * 1024 * 
1024 * 1024;

Review Comment:
   Too many configs. Need improve.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -1788,5 +1790,78 @@ private StatementBase setParsedStmt(StatementBase 
parsedStmt) {
         this.statementContext.setParsedStatement(parsedStmt);
         return parsedStmt;
     }
+
+    public List<ResultRow> executeInternalQuery() {
+        analyzer = new Analyzer(context.getEnv(), context);
+        try {
+            analyze(context.getSessionVariable().toThrift());
+        } catch (UserException e) {
+            LOG.warn("Internal SQL execution failed, SQL: {}", originStmt, e);
+            return null;
+        }
+        planner.getFragments();
+        RowBatch batch;
+        coord = new Coordinator(context, analyzer, planner);
+        try {
+            QeProcessorImpl.INSTANCE.registerQuery(context.queryId(),
+                    new QeProcessorImpl.QueryInfo(context, 
originStmt.originStmt, coord));
+        } catch (UserException e) {
+            LOG.warn(e.getMessage(), e);
+        }
+
+        coord.setProfileWriter(this);
+        Span queryScheduleSpan = context.getTracer()

Review Comment:
   Do we still need `span` for internal query?



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