ryan-syed opened a new issue, #3389:
URL: https://github.com/apache/arrow-adbc/issues/3389

   ### What happened?
   
   There is a bug in the Apache drivers where the `ValidateConnection` method 
doesn't throw an error if the port is missing or unspecified
   
   Example port validation logic
   
   ```
   // Validate port range
   Properties.TryGetValue(SparkParameters.Port, out string? port);
   if (int.TryParse(port, out int portNumber) && (portNumber <= 
IPEndPoint.MinPort || portNumber > IPEndPoint.MaxPort))
       throw new ArgumentOutOfRangeException(
           nameof(Properties),
           port,
           $"Parameter '{SparkParameters.Port}' value is not in the valid range 
of 1 .. {IPEndPoint.MaxPort}.");
   ```
   The above logic ends up parsing a missing or null port value as a zero port 
number and doesn't throw an error
   
   The logic should instead be modified to something like:
   
   ```
   // Validate port range
   Properties.TryGetValue(SparkParameters.Port, out string? port);
   if (string.IsNullOrWhiteSpace(port))
   {
       throw new ArgumentException(
           $"Required parameter '{SparkParameters.Port}' is missing. Please 
provide a port number for the data source.",
           nameof(Properties));
   }
   if (int.TryParse(port, out int portNumber) && (portNumber <= 
IPEndPoint.MinPort || portNumber > IPEndPoint.MaxPort))
   {
       throw new ArgumentOutOfRangeException(
           nameof(Properties),
           port,
           $"Parameter '{SparkParameters.Port}' value is not in the valid range 
of 1 .. {IPEndPoint.MaxPort}.");
   }
   ```
   This needs to be fixed for Spark, Hive, and Impala.
   
   ### Stack Trace
   
   _No response_
   
   ### How can we reproduce the bug?
   
   _No response_
   
   ### Environment/Setup
   
   _No response_


-- 
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: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to