@@ -2079,12 +2079,8 @@ func shouldDistributeGivenRecAndMode(
2079
2079
// remote node to the gateway.
2080
2080
// TODO(yuzefovich): this will be easy to solve once the DistSQL spec factory is
2081
2081
// completed but is quite annoying to do at the moment.
2082
- func getPlanDistribution (
2083
- ctx context.Context ,
2084
- txnHasUncommittedTypes bool ,
2085
- sd * sessiondata.SessionData ,
2086
- plan planMaybePhysical ,
2087
- distSQLVisitor * distSQLExprCheckVisitor ,
2082
+ func (p * planner ) getPlanDistribution (
2083
+ ctx context.Context , plan planMaybePhysical ,
2088
2084
) (_ physicalplan.PlanDistribution , distSQLProhibitedErr error ) {
2089
2085
if plan .isPhysicalPlan () {
2090
2086
// TODO(#47473): store the distSQLProhibitedErr for DistSQL spec factory
@@ -2095,10 +2091,11 @@ func getPlanDistribution(
2095
2091
// If this transaction has modified or created any types, it is not safe to
2096
2092
// distribute due to limitations around leasing descriptors modified in the
2097
2093
// current transaction.
2098
- if txnHasUncommittedTypes {
2094
+ if p . Descriptors (). HasUncommittedDescriptors () {
2099
2095
return physicalplan .LocalPlan , nil
2100
2096
}
2101
2097
2098
+ sd := p .SessionData ()
2102
2099
if sd .DistSQLMode == sessiondatapb .DistSQLOff {
2103
2100
return physicalplan .LocalPlan , nil
2104
2101
}
@@ -2108,7 +2105,7 @@ func getPlanDistribution(
2108
2105
return physicalplan .LocalPlan , nil
2109
2106
}
2110
2107
2111
- rec , err := checkSupportForPlanNode (ctx , plan .planNode , distSQLVisitor , sd )
2108
+ rec , err := checkSupportForPlanNode (ctx , plan .planNode , & p . distSQLVisitor , sd )
2112
2109
if err != nil {
2113
2110
// Don't use distSQL for this request.
2114
2111
log .VEventf (ctx , 1 , "query not supported for distSQL: %s" , err )
0 commit comments