[Bug-fix] Avoid using 'QueryDetail' in planning stage (#6018)
QueryDetail is used to statistic the current query details. This property will only be set when the query starts to execute. So in the query planning stage, using this attribute in the first query will cause 'NullPointerException'. After that, this attribute retains the value of the previous query until it is updated by the subsequent process. Because code of 'colocateagg' uses this attribute incorrectly in its planning, it causes 'NullPointerException' when clients like pymysql connect to doris and send the first query. Fixed #6017
This commit is contained in:
@ -988,7 +988,7 @@ public class DistributedPlanner {
|
||||
private boolean canColocateAgg(AggregateInfo aggregateInfo, List<DataPartition> childFragmentDataPartition) {
|
||||
// Condition1
|
||||
if (ConnectContext.get().getSessionVariable().isDisableColocatePlan()) {
|
||||
LOG.debug("Agg node is not colocate in:" + ConnectContext.get().getQueryDetail().getQueryId()
|
||||
LOG.debug("Agg node is not colocate in:" + ConnectContext.get().queryId()
|
||||
+ ", reason:" + DistributedPlanColocateRule.SESSION_DISABLED);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -98,6 +98,9 @@ public class ConnectContext {
|
||||
|
||||
protected String remoteIP;
|
||||
|
||||
// This is used to statistic the current query details.
|
||||
// This property will only be set when the query starts to execute.
|
||||
// So in the query planning stage, do not use any value in this attribute.
|
||||
protected QueryDetail queryDetail;
|
||||
|
||||
public static ConnectContext get() {
|
||||
|
||||
Reference in New Issue
Block a user