@@ -2220,12 +2220,8 @@ func shouldDistributeGivenRecAndMode(
2220
2220
// remote node to the gateway.
2221
2221
// TODO(yuzefovich): this will be easy to solve once the DistSQL spec factory is
2222
2222
// completed but is quite annoying to do at the moment.
2223
- func getPlanDistribution (
2224
- ctx context.Context ,
2225
- txnHasUncommittedTypes bool ,
2226
- sd * sessiondata.SessionData ,
2227
- plan planMaybePhysical ,
2228
- distSQLVisitor * distSQLExprCheckVisitor ,
2223
+ func (p * planner ) getPlanDistribution (
2224
+ ctx context.Context , plan planMaybePhysical ,
2229
2225
) (_ physicalplan.PlanDistribution , distSQLProhibitedErr error ) {
2230
2226
if plan .isPhysicalPlan () {
2231
2227
// TODO(#47473): store the distSQLProhibitedErr for DistSQL spec factory
@@ -2236,10 +2232,11 @@ func getPlanDistribution(
2236
2232
// If this transaction has modified or created any types, it is not safe to
2237
2233
// distribute due to limitations around leasing descriptors modified in the
2238
2234
// current transaction.
2239
- if txnHasUncommittedTypes {
2235
+ if p . Descriptors (). HasUncommittedDescriptors () {
2240
2236
return physicalplan .LocalPlan , nil
2241
2237
}
2242
2238
2239
+ sd := p .SessionData ()
2243
2240
if sd .DistSQLMode == sessiondatapb .DistSQLOff {
2244
2241
return physicalplan .LocalPlan , nil
2245
2242
}
@@ -2249,7 +2246,7 @@ func getPlanDistribution(
2249
2246
return physicalplan .LocalPlan , nil
2250
2247
}
2251
2248
2252
- rec , err := checkSupportForPlanNode (ctx , plan .planNode , distSQLVisitor , sd )
2249
+ rec , err := checkSupportForPlanNode (ctx , plan .planNode , & p . distSQLVisitor , sd )
2253
2250
if err != nil {
2254
2251
// Don't use distSQL for this request.
2255
2252
log .VEventf (ctx , 1 , "query not supported for distSQL: %s" , err )
0 commit comments