@@ -81,11 +81,19 @@ pub struct Stage {
8181 pub tasks : Vec < ExecutionTask > ,
8282}
8383
84- #[ derive( Debug , Clone ) ]
84+ #[ derive( Debug , Clone , Default ) ]
8585pub struct ExecutionTask {
8686 /// The url of the worker that will execute this task. A None value is interpreted as
8787 /// unassigned.
8888 pub ( crate ) url : Option < Url > ,
89+ // Affinity key that can be used for consistent routing with the task router.
90+ pub ( crate ) affinity_key : Option < Vec < u8 > > ,
91+ }
92+
93+ impl ExecutionTask {
94+ pub ( crate ) fn new ( url : Option < Url > , affinity_key : Option < Vec < u8 > > ) -> Self {
95+ Self { url, affinity_key }
96+ }
8997}
9098
9199#[ derive( Debug , Clone , PartialEq ) ]
@@ -118,7 +126,7 @@ impl Stage {
118126 query_id,
119127 num,
120128 plan : Some ( plan) ,
121- tasks : vec ! [ ExecutionTask { url : None } ; n_tasks] ,
129+ tasks : vec ! [ ExecutionTask :: default ( ) ; n_tasks] ,
122130 }
123131 }
124132}
@@ -439,7 +447,7 @@ pub fn display_plan_graphviz(plan: Arc<dyn ExecutionPlan>) -> Result<String> {
439447 query_id : Default :: default ( ) ,
440448 num : max_num + 1 ,
441449 plan : Some ( plan. clone ( ) ) ,
442- tasks : vec ! [ ExecutionTask { url : None } ] ,
450+ tasks : vec ! [ ExecutionTask :: default ( ) ] ,
443451 } ;
444452 all_stages. insert ( 0 , & head_stage) ;
445453
0 commit comments