avantgardnerio commented on code in PR #442:
URL: https://github.com/apache/arrow-ballista/pull/442#discussion_r1003762368


##########
ballista/scheduler/src/flight_sql.rs:
##########
@@ -196,26 +196,41 @@ impl FlightSqlServiceImpl {
     ) -> Result<Vec<FlightEndpoint>, Status> {
         let mut fieps: Vec<_> = vec![];
         for loc in completed.partition_location.iter() {
-            let (host, port) = if let Some(ref md) = loc.executor_meta {
+
+            let (exec_host, exec_port) = if let Some(ref md) = 
loc.executor_meta {
                 (md.host.clone(), md.port)
             } else {
                 Err(Status::internal(
-                    "Invalid partition location, missing executor 
metadata".to_string(),
+                    "Invalid partition location, missing executor metadata and 
advertise_host flag is undefined.".to_string(),
                 ))?
             };
+
+            let (host, port) = match self.server.advertise_host {
+                Some(_) => {
+                    let advertise_host_flag: Vec<&str> = self
+                        .server
+                        .advertise_host
+                        .as_ref()
+                        .unwrap()

Review Comment:
   I think we want to avoid `unwrap()`s as a rule, but especially in functions 
that already return `Result`s...



##########
ballista/scheduler/scheduler_config_spec.toml:
##########
@@ -24,6 +24,11 @@ conf_file_param = "config_file"
 name = "version"
 doc = "Print version of this executable"
 
+[[param]]
+name = "advertise_host"

Review Comment:
   I love the use of the word `advertise` as that is what it is commonly 
called. I dislike the word `host`, because this is hostname & port. Sadly the 
term for that appears to be "socket", which I think no one uses outside OS 
libraries 
https://stackoverflow.com/questions/34955747/whats-the-combination-of-an-ip-address-and-port-number-called



##########
ballista/scheduler/src/flight_sql.rs:
##########
@@ -196,26 +196,41 @@ impl FlightSqlServiceImpl {
     ) -> Result<Vec<FlightEndpoint>, Status> {
         let mut fieps: Vec<_> = vec![];
         for loc in completed.partition_location.iter() {
-            let (host, port) = if let Some(ref md) = loc.executor_meta {
+
+            let (exec_host, exec_port) = if let Some(ref md) = 
loc.executor_meta {
                 (md.host.clone(), md.port)
             } else {
                 Err(Status::internal(
-                    "Invalid partition location, missing executor 
metadata".to_string(),
+                    "Invalid partition location, missing executor metadata and 
advertise_host flag is undefined.".to_string(),
                 ))?
             };
+
+            let (host, port) = match self.server.advertise_host {
+                Some(_) => {
+                    let advertise_host_flag: Vec<&str> = self
+                        .server
+                        .advertise_host
+                        .as_ref()
+                        .unwrap()
+                        .split(":")
+                        .collect();
+                    (advertise_host_flag[0].to_string(), 
advertise_host_flag[1].parse().unwrap())

Review Comment:
   Same... I think there is a safe way to index into the array: 
https://adventures.michaelfbryan.com/posts/daily/slice-patterns/



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to