[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:
EmmyMiao87
2021-06-16 09:40:53 +08:00
committed by GitHub
parent 800c2c41bd
commit d2c1cddd55
2 changed files with 4 additions and 1 deletions

View File

@ -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;
}

View File

@ -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() {