cloud-fan commented on code in PR #56356:
URL: https://github.com/apache/spark/pull/56356#discussion_r3377761343


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogV2Util.scala:
##########
@@ -78,6 +78,17 @@ private[sql] object CatalogV2Util {
       SupportsNamespaces.PROP_LOCATION,
       SupportsNamespaces.PROP_OWNER)
 
+  /**
+   * Checks if a location string is blank (empty or contains only whitespace 
characters).
+   * This validation is used to reject invalid database/namespace locations.
+   *
+   * @param location the location string to validate
+   * @return true if the location is null, empty, or contains only whitespace
+   */
+  def isBlankLocation(location: String): Boolean = {

Review Comment:
   This duplicates the existing `SparkStringUtils.isBlank` (`str == null || 
str.isBlank`) — and both production files removed their `SparkStringUtils` 
import to add this new helper. Suggest dropping `isBlankLocation` and calling 
`SparkStringUtils.isBlank(...)` at the four sites instead (keeping the imports):
   
   - `ResolveSessionCatalog`: `SparkStringUtils.isBlank(location)` and 
`location.exists(SparkStringUtils.isBlank)`
   - `DataSourceV2Strategy`: same
   
   `isBlank` is also marginally more correct here: it uses 
`Character.isWhitespace`, a superset of what `trim` strips (`<= U+0020`).



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to