datafusion-distributed 2.0.0

Framework for enhancing Apache DataFusion with distributed capabilities
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CoordinatorToWorkerMsg {
    #[prost(oneof = "coordinator_to_worker_msg::Inner", tags = "1, 2")]
    pub inner: ::core::option::Option<coordinator_to_worker_msg::Inner>,
}
/// Nested message and enum types in `CoordinatorToWorkerMsg`.
pub mod coordinator_to_worker_msg {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Inner {
        /// Sends a subplan to a worker so that a future ExecuteTask call can actually execute it.
        /// The plan is identified by a TaskKey.
        #[prost(message, tag = "1")]
        SetPlanRequest(super::SetPlanRequest),
        /// A batch of messages from a work unit feed belonging to different partitions from one node from the plan set in
        /// set_plan_request. A work unit feed is a per-partition stream of information that tells the node what should
        /// be executed within a partition, for example, a stream of file addresses that should be read.
        #[prost(message, tag = "2")]
        WorkUnitBatch(super::WorkUnitBatch),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WorkerToCoordinatorMsg {
    #[prost(oneof = "worker_to_coordinator_msg::Inner", tags = "1")]
    pub inner: ::core::option::Option<worker_to_coordinator_msg::Inner>,
}
/// Nested message and enum types in `WorkerToCoordinatorMsg`.
pub mod worker_to_coordinator_msg {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Inner {
        /// Sends the metrics collected during task execution back to the coordinator.
        /// This is sent after all partitions of a task have finished (or been dropped),
        /// ensuring metrics are never lost due to early stream termination.
        /// metrics\[i\] is the set of metrics for plan node i in pre-order traversal order.
        #[prost(message, tag = "1")]
        TaskMetrics(super::TaskMetrics),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskMetrics {
    /// Metrics for a single task's plan nodes in pre-order traversal order.
    /// The TaskKey is implicit — it is determined by the SetPlanRequest that
    /// opened this coordinator channel connection.
    #[prost(message, repeated, tag = "1")]
    pub pre_order_plan_metrics: ::prost::alloc::vec::Vec<MetricsSet>,
    /// Metrics related to the execution of a task within a stage. This metrics, instead of being
    /// associated to a specific node, they are global to the task, like the time at which the plan
    /// was fed by the coordinator to the worker.
    #[prost(message, optional, tag = "2")]
    pub task_metrics: ::core::option::Option<MetricsSet>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetWorkerInfoRequest {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetWorkerInfoResponse {
    #[prost(string, tag = "1")]
    pub version: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetPlanRequest {
    /// The unique identifier of the task to which the subplan belongs to.
    #[prost(message, optional, tag = "1")]
    pub task_key: ::core::option::Option<TaskKey>,
    /// The amount of tasks that share the same subplan. Necessary for building the DistributedTaskContext during execution.
    #[prost(uint64, tag = "2")]
    pub task_count: u64,
    /// The serialized subplan the worker is expected to execute on an ExecuteTask gRPC call.
    #[prost(bytes = "vec", tag = "3")]
    pub plan_proto: ::prost::alloc::vec::Vec<u8>,
    /// Information about all the work unit feeds that will be streamed from coordinator to worker.
    /// This information is needed here because at the moment of setting the plan, all the appropriate
    /// channels for the incoming work unit feeds need to be constructed.
    ///
    /// If no WorkUnitFeedExec nodes are present in the plan, this should be empty.
    #[prost(message, repeated, tag = "4")]
    pub work_unit_feed_declarations:
        ::prost::alloc::vec::Vec<set_plan_request::WorkUnitFeedDeclaration>,
    /// The worker URL to which this message will go. The receiving worker will use this information to identify
    /// itself, and avoid further gRPC calls in case it needs to call itself for executing remote tasks.
    #[prost(string, tag = "5")]
    pub target_worker_url: ::prost::alloc::string::String,
    /// Unix nanos when the query started as reported by the coordinator. Used for collecting temporal metrics
    /// relative to when the query was fired in the coordinator.
    #[prost(uint64, tag = "6")]
    pub query_start_time_ns: u64,
}
/// Nested message and enum types in `SetPlanRequest`.
pub mod set_plan_request {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct WorkUnitFeedDeclaration {
        /// Unique identifier of the node to which work unit feeds are expected to be streamed.
        #[prost(bytes = "vec", tag = "1")]
        pub id: ::prost::alloc::vec::Vec<u8>,
        /// The amount of partitions expected to be streamed.
        #[prost(uint64, tag = "2")]
        pub partitions: u64,
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WorkUnitBatch {
    /// A batch of WorkUnits.
    #[prost(message, repeated, tag = "1")]
    pub batch: ::prost::alloc::vec::Vec<WorkUnit>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WorkUnit {
    /// Identifier of the node to which this work unit feed belongs to.
    #[prost(bytes = "vec", tag = "1")]
    pub id: ::prost::alloc::vec::Vec<u8>,
    /// The partition index within the node to which the work unit feed belongs to.
    #[prost(uint64, tag = "2")]
    pub partition: u64,
    /// Arbitrary user-defined data (e.g., a file address) necessary during execution.
    #[prost(bytes = "vec", tag = "3")]
    pub body: ::prost::alloc::vec::Vec<u8>,
    /// Unix timestamp in nanoseconds at which this message was created in the coordinator.
    #[prost(uint64, tag = "4")]
    pub created_timestamp_unix_nanos: u64,
    /// Unix timestamp in nanoseconds at which this message was sent by the coordinator.
    #[prost(uint64, tag = "5")]
    pub sent_timestamp_unix_nanos: u64,
    /// Unix timestamp in nanoseconds at which this message was received by a worker.
    #[prost(uint64, tag = "6")]
    pub received_timestamp_unix_nanos: u64,
    /// Unix timestamp in nanoseconds at which this message started being processed.
    #[prost(uint64, tag = "7")]
    pub processed_timestamp_unix_nanos: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExecuteTaskRequest {
    /// The unique identifier of the task that is going to get executed.
    #[prost(message, optional, tag = "1")]
    pub task_key: ::core::option::Option<TaskKey>,
    /// The start of the partition range of the specified task that is going to be executed.
    #[prost(uint64, tag = "2")]
    pub target_partition_start: u64,
    /// The end of the partition range of the specified task that is going to be executed.
    #[prost(uint64, tag = "3")]
    pub target_partition_end: u64,
    /// The head node the requested task should have. Depending on the network boundary executing
    /// the task, the head node should be prepared differently, for example:
    ///
    /// * A RepartitionExecHead implies a RepartitionExec at the head of the task.
    /// * A BroadcastExecHead implies a BroadcastExec at the head of the task.
    /// * A NoneHead does not need any specific head.
    #[prost(oneof = "execute_task_request::ProducerHead", tags = "6, 7, 8")]
    pub producer_head: ::core::option::Option<execute_task_request::ProducerHead>,
}
/// Nested message and enum types in `ExecuteTaskRequest`.
pub mod execute_task_request {
    /// The head node the requested task should have. Depending on the network boundary executing
    /// the task, the head node should be prepared differently, for example:
    ///
    /// * A RepartitionExecHead implies a RepartitionExec at the head of the task.
    /// * A BroadcastExecHead implies a BroadcastExec at the head of the task.
    /// * A NoneHead does not need any specific head.
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum ProducerHead {
        /// The boundary executing the task is a NetworkCoalesceExec.
        #[prost(message, tag = "6")]
        None(super::NoneHead),
        /// The boundary executing the task is a NetworkBroadcastExec.
        #[prost(message, tag = "7")]
        Broadcast(super::BroadcastExecHead),
        /// The boundary executing the task is a NetworkShuffleExec.
        #[prost(message, tag = "8")]
        Repartition(super::RepartitionExecHead),
    }
}
/// Head needed by a NetworkCoalesceExec.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct NoneHead {}
/// Head needed by a NetworkBroadcastExec.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BroadcastExecHead {
    /// The amount of output partitions
    #[prost(uint64, tag = "1")]
    pub output_partitions: u64,
}
/// Head needed by a NetworkShuffleExec.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RepartitionExecHead {
    /// `Partitioning` message from datafusion.proto
    #[prost(bytes = "vec", tag = "1")]
    pub partitioning: ::prost::alloc::vec::Vec<u8>,
}
/// A key that uniquely identifies a task in a query.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TaskKey {
    /// Our query id.
    #[prost(bytes = "vec", tag = "1")]
    pub query_id: ::prost::alloc::vec::Vec<u8>,
    /// Our stage id.
    #[prost(uint64, tag = "2")]
    pub stage_id: u64,
    /// The task number within the stage.
    #[prost(uint64, tag = "3")]
    pub task_number: u64,
}
/// FlightAppMetadata represents all types of app_metadata which we use in the distributed execution.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FlightAppMetadata {
    #[prost(uint64, tag = "1")]
    pub partition: u64,
    /// Unix timestamp in nanoseconds at which this message was created.
    #[prost(uint64, tag = "2")]
    pub created_timestamp_unix_nanos: u64,
}
/// A Label mirrors datafusion::physical_plan::metrics::Label.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Label {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub value: ::prost::alloc::string::String,
}
/// A Metric is a protobuf mirror of datafusion::physical_plan::metrics::Metric.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Metric {
    #[prost(message, repeated, tag = "1")]
    pub labels: ::prost::alloc::vec::Vec<Label>,
    #[prost(uint64, optional, tag = "2")]
    pub partition: ::core::option::Option<u64>,
    #[prost(
        oneof = "metric::Value",
        tags = "10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34"
    )]
    pub value: ::core::option::Option<metric::Value>,
}
/// Nested message and enum types in `Metric`.
pub mod metric {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Value {
        #[prost(message, tag = "10")]
        OutputRows(super::OutputRows),
        #[prost(message, tag = "11")]
        ElapsedCompute(super::ElapsedCompute),
        #[prost(message, tag = "12")]
        SpillCount(super::SpillCount),
        #[prost(message, tag = "13")]
        SpilledBytes(super::SpilledBytes),
        #[prost(message, tag = "14")]
        SpilledRows(super::SpilledRows),
        #[prost(message, tag = "15")]
        CurrentMemoryUsage(super::CurrentMemoryUsage),
        #[prost(message, tag = "16")]
        Count(super::NamedCount),
        #[prost(message, tag = "17")]
        Gauge(super::NamedGauge),
        #[prost(message, tag = "18")]
        Time(super::NamedTime),
        #[prost(message, tag = "19")]
        StartTimestamp(super::StartTimestamp),
        #[prost(message, tag = "20")]
        EndTimestamp(super::EndTimestamp),
        #[prost(message, tag = "21")]
        OutputBytes(super::OutputBytes),
        #[prost(message, tag = "22")]
        OutputBatches(super::OutputBatches),
        #[prost(message, tag = "23")]
        PruningMetrics(super::NamedPruningMetrics),
        #[prost(message, tag = "24")]
        Ratio(super::NamedRatio),
        #[prost(message, tag = "25")]
        CustomMinLatency(super::MinLatency),
        #[prost(message, tag = "26")]
        CustomMaxLatency(super::MaxLatency),
        #[prost(message, tag = "27")]
        CustomAvgLatency(super::AvgLatency),
        #[prost(message, tag = "28")]
        CustomFirstLatency(super::FirstLatency),
        #[prost(message, tag = "29")]
        CustomBytesCount(super::BytesCount),
        #[prost(message, tag = "30")]
        CustomP50Latency(super::PercentileLatency),
        #[prost(message, tag = "31")]
        CustomP75Latency(super::PercentileLatency),
        #[prost(message, tag = "32")]
        CustomP95Latency(super::PercentileLatency),
        #[prost(message, tag = "33")]
        CustomP99Latency(super::PercentileLatency),
        #[prost(message, tag = "34")]
        CustomMaxGauge(super::MaxGauge),
    }
}
/// A MetricsSet is a protobuf mirror of datafusion::physical_plan::metrics::MetricsSet. It represents
/// a collection of metrics for one ExecutionPlan node.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MetricsSet {
    #[prost(message, repeated, tag = "1")]
    pub metrics: ::prost::alloc::vec::Vec<Metric>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct OutputRows {
    #[prost(uint64, tag = "1")]
    pub value: u64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ElapsedCompute {
    #[prost(uint64, tag = "1")]
    pub value: u64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SpillCount {
    #[prost(uint64, tag = "1")]
    pub value: u64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SpilledBytes {
    #[prost(uint64, tag = "1")]
    pub value: u64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SpilledRows {
    #[prost(uint64, tag = "1")]
    pub value: u64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CurrentMemoryUsage {
    #[prost(uint64, tag = "1")]
    pub value: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct NamedCount {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub value: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct NamedGauge {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub value: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct NamedTime {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub value: u64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StartTimestamp {
    #[prost(int64, optional, tag = "1")]
    pub value: ::core::option::Option<i64>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct EndTimestamp {
    #[prost(int64, optional, tag = "1")]
    pub value: ::core::option::Option<i64>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct OutputBytes {
    #[prost(uint64, tag = "1")]
    pub value: u64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct OutputBatches {
    #[prost(uint64, tag = "1")]
    pub value: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct NamedPruningMetrics {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub pruned: u64,
    #[prost(uint64, tag = "3")]
    pub matched: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct NamedRatio {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub part: u64,
    #[prost(uint64, tag = "3")]
    pub total: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BytesCount {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub value: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MinLatency {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub value: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MaxLatency {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub value: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AvgLatency {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub nanos_sum: u64,
    #[prost(uint64, tag = "3")]
    pub count: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FirstLatency {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub value: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PercentileLatency {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(bytes = "vec", tag = "4")]
    pub sketch_bytes: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MaxGauge {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub value: u64,
}
/// Generated client implementations.
pub mod worker_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value
    )]
    use tonic::codegen::http::Uri;
    use tonic::codegen::*;
    #[derive(Debug, Clone)]
    pub struct WorkerServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl WorkerServiceClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> WorkerServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> WorkerServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                    http::Request<tonic::body::Body>,
                    Response = http::Response<
                        <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                    >,
                >,
            <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
                Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            WorkerServiceClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// Establishes a bidirectional message stream between a coordinator and a worker, over which messages
        /// will be exchanged at any time during a query's lifetime. It's expected to be one coordinator channel
        /// per task.
        pub async fn coordinator_channel(
            &mut self,
            request: impl tonic::IntoStreamingRequest<Message = super::CoordinatorToWorkerMsg>,
        ) -> std::result::Result<
            tonic::Response<tonic::codec::Streaming<super::WorkerToCoordinatorMsg>>,
            tonic::Status,
        > {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
            })?;
            let codec = tonic_prost::ProstCodec::default();
            let path =
                http::uri::PathAndQuery::from_static("/worker.WorkerService/CoordinatorChannel");
            let mut req = request.into_streaming_request();
            req.extensions_mut().insert(GrpcMethod::new(
                "worker.WorkerService",
                "CoordinatorChannel",
            ));
            self.inner.streaming(req, path, codec).await
        }
        /// Executes the requested partition range of a subplan previously sent by the coordinator channel.
        pub async fn execute_task(
            &mut self,
            request: impl tonic::IntoRequest<super::ExecuteTaskRequest>,
        ) -> std::result::Result<
            tonic::Response<tonic::codec::Streaming<::arrow_flight::FlightData>>,
            tonic::Status,
        > {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
            })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static("/worker.WorkerService/ExecuteTask");
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("worker.WorkerService", "ExecuteTask"));
            self.inner.server_streaming(req, path, codec).await
        }
        /// Returns metadata about a worker. Currently only used for worker versioning.
        pub async fn get_worker_info(
            &mut self,
            request: impl tonic::IntoRequest<super::GetWorkerInfoRequest>,
        ) -> std::result::Result<tonic::Response<super::GetWorkerInfoResponse>, tonic::Status>
        {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
            })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static("/worker.WorkerService/GetWorkerInfo");
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("worker.WorkerService", "GetWorkerInfo"));
            self.inner.unary(req, path, codec).await
        }
    }
}
/// Generated server implementations.
pub mod worker_service_server {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value
    )]
    use tonic::codegen::*;
    /// Generated trait containing gRPC methods that should be implemented for use with WorkerServiceServer.
    #[async_trait]
    pub trait WorkerService: std::marker::Send + std::marker::Sync + 'static {
        /// Server streaming response type for the CoordinatorChannel method.
        type CoordinatorChannelStream: tonic::codegen::tokio_stream::Stream<
                Item = std::result::Result<super::WorkerToCoordinatorMsg, tonic::Status>,
            > + std::marker::Send
            + 'static;
        /// Establishes a bidirectional message stream between a coordinator and a worker, over which messages
        /// will be exchanged at any time during a query's lifetime. It's expected to be one coordinator channel
        /// per task.
        async fn coordinator_channel(
            &self,
            request: tonic::Request<tonic::Streaming<super::CoordinatorToWorkerMsg>>,
        ) -> std::result::Result<tonic::Response<Self::CoordinatorChannelStream>, tonic::Status>;
        /// Server streaming response type for the ExecuteTask method.
        type ExecuteTaskStream: tonic::codegen::tokio_stream::Stream<
                Item = std::result::Result<::arrow_flight::FlightData, tonic::Status>,
            > + std::marker::Send
            + 'static;
        /// Executes the requested partition range of a subplan previously sent by the coordinator channel.
        async fn execute_task(
            &self,
            request: tonic::Request<super::ExecuteTaskRequest>,
        ) -> std::result::Result<tonic::Response<Self::ExecuteTaskStream>, tonic::Status>;
        /// Returns metadata about a worker. Currently only used for worker versioning.
        async fn get_worker_info(
            &self,
            request: tonic::Request<super::GetWorkerInfoRequest>,
        ) -> std::result::Result<tonic::Response<super::GetWorkerInfoResponse>, tonic::Status>;
    }
    #[derive(Debug)]
    pub struct WorkerServiceServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> WorkerServiceServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> Self {
            Self {
                inner,
                accept_compression_encodings: Default::default(),
                send_compression_encodings: Default::default(),
                max_decoding_message_size: None,
                max_encoding_message_size: None,
            }
        }
        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
        where
            F: tonic::service::Interceptor,
        {
            InterceptedService::new(Self::new(inner), interceptor)
        }
        /// Enable decompressing requests with the given encoding.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.accept_compression_encodings.enable(encoding);
            self
        }
        /// Compress responses with the given encoding, if the client supports it.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.send_compression_encodings.enable(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.max_decoding_message_size = Some(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.max_encoding_message_size = Some(limit);
            self
        }
    }
    impl<T, B> tonic::codegen::Service<http::Request<B>> for WorkerServiceServer<T>
    where
        T: WorkerService,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::Body>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/worker.WorkerService/CoordinatorChannel" => {
                    #[allow(non_camel_case_types)]
                    struct CoordinatorChannelSvc<T: WorkerService>(pub Arc<T>);
                    impl<T: WorkerService>
                        tonic::server::StreamingService<super::CoordinatorToWorkerMsg>
                        for CoordinatorChannelSvc<T>
                    {
                        type Response = super::WorkerToCoordinatorMsg;
                        type ResponseStream = T::CoordinatorChannelStream;
                        type Future =
                            BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
                        fn call(
                            &mut self,
                            request: tonic::Request<
                                tonic::Streaming<super::CoordinatorToWorkerMsg>,
                            >,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as WorkerService>::coordinator_channel(&inner, request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = CoordinatorChannelSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.streaming(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/worker.WorkerService/ExecuteTask" => {
                    #[allow(non_camel_case_types)]
                    struct ExecuteTaskSvc<T: WorkerService>(pub Arc<T>);
                    impl<T: WorkerService>
                        tonic::server::ServerStreamingService<super::ExecuteTaskRequest>
                        for ExecuteTaskSvc<T>
                    {
                        type Response = ::arrow_flight::FlightData;
                        type ResponseStream = T::ExecuteTaskStream;
                        type Future =
                            BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::ExecuteTaskRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as WorkerService>::execute_task(&inner, request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = ExecuteTaskSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.server_streaming(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/worker.WorkerService/GetWorkerInfo" => {
                    #[allow(non_camel_case_types)]
                    struct GetWorkerInfoSvc<T: WorkerService>(pub Arc<T>);
                    impl<T: WorkerService> tonic::server::UnaryService<super::GetWorkerInfoRequest>
                        for GetWorkerInfoSvc<T>
                    {
                        type Response = super::GetWorkerInfoResponse;
                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::GetWorkerInfoRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as WorkerService>::get_worker_info(&inner, request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = GetWorkerInfoSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                _ => Box::pin(async move {
                    let mut response = http::Response::new(tonic::body::Body::default());
                    let headers = response.headers_mut();
                    headers.insert(
                        tonic::Status::GRPC_STATUS,
                        (tonic::Code::Unimplemented as i32).into(),
                    );
                    headers.insert(
                        http::header::CONTENT_TYPE,
                        tonic::metadata::GRPC_CONTENT_TYPE,
                    );
                    Ok(response)
                }),
            }
        }
    }
    impl<T> Clone for WorkerServiceServer<T> {
        fn clone(&self) -> Self {
            let inner = self.inner.clone();
            Self {
                inner,
                accept_compression_encodings: self.accept_compression_encodings,
                send_compression_encodings: self.send_compression_encodings,
                max_decoding_message_size: self.max_decoding_message_size,
                max_encoding_message_size: self.max_encoding_message_size,
            }
        }
    }
    /// Generated gRPC service name
    pub const SERVICE_NAME: &str = "worker.WorkerService";
    impl<T> tonic::server::NamedService for WorkerServiceServer<T> {
        const NAME: &'static str = SERVICE_NAME;
    }
}