@@ -28,13 +28,9 @@ pub struct ArrowFlightEndpoint {
2828 pub ( super ) task_data_entries : Arc < TTLMap < StageKey , Arc < OnceCell < TaskData > > > > ,
2929 pub ( super ) session_builder : Arc < dyn DistributedSessionBuilder + Send + Sync > ,
3030 pub ( super ) hooks : ArrowFlightEndpointHooks ,
31- max_message_size : usize ,
31+ pub ( super ) max_message_size : Option < usize > ,
3232}
3333
34- /// Default maximum message size for FlightData chunks in ArrowFlightEndpoint.
35- /// This is the size used for chunking FlightData within the endpoint.
36- const DEFAULT_MESSAGE_SIZE : usize = 2 * 1024 * 1024 ; // 2 MB
37-
3834impl ArrowFlightEndpoint {
3935 pub fn try_new (
4036 session_builder : impl DistributedSessionBuilder + Send + Sync + ' static ,
@@ -45,7 +41,7 @@ impl ArrowFlightEndpoint {
4541 task_data_entries : Arc :: new ( ttl_map) ,
4642 session_builder : Arc :: new ( session_builder) ,
4743 hooks : ArrowFlightEndpointHooks :: default ( ) ,
48- max_message_size : DEFAULT_MESSAGE_SIZE ,
44+ max_message_size : None ,
4945 } )
5046 }
5147
@@ -62,14 +58,19 @@ impl ArrowFlightEndpoint {
6258 }
6359
6460 /// Set the maximum message size for FlightData chunks.
65- /// Defaults to 2 MB.
61+ ///
62+ /// Defaults to None, which uses `arrow-rs` default, curerntly 2MB.
63+ /// See [`FlightDataEncoderBuilder::with_max_flight_data_size`] for details.
64+ ///
6665 /// If you change this, ensure you configure the server's max_encoding_message_size and
6766 /// max_decoding_message_size to at least 2x this value to allow for overhead.
6867 /// If your service communication is purely internal and there is no risk of DOS attacks,
6968 /// you may want to set this to a considerably larger value to minimize the overhead of chunking
7069 /// larger datasets.
70+ ///
71+ /// [`FlightDataEncoderBuilder::with_max_flight_data_size`]: https://arrow.apache.org/rust/arrow_flight/encode/struct.FlightDataEncoderBuilder.html#structfield.max_flight_data_size
7172 pub fn with_max_message_size ( mut self , size : usize ) -> Self {
72- self . max_message_size = size;
73+ self . max_message_size = Some ( size) ;
7374 self
7475 }
7576}
0 commit comments