srowen commented on code in PR #40588:
URL: https://github.com/apache/spark/pull/40588#discussion_r1155159586
##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala:
##########
@@ -217,10 +218,17 @@ private object PostgresDialect extends JdbcDialect with
SQLConfHelper {
case "42P07" =>
// The message is: Failed to create index indexName in tableName
val regex = "(?s)Failed to create index (.*) in (.*)".r
- val indexName = regex.findFirstMatchIn(message).get.group(1)
- val tableName = regex.findFirstMatchIn(message).get.group(2)
- throw new IndexAlreadyExistsException(
- indexName = indexName, tableName = tableName, cause = Some(e))
+ val maybeMatchIndex = regex.findFirstMatchIn(message)
Review Comment:
Nit: you can use regexes in match expressions, it'd be a little cleaner. See
end of https://docs.scala-lang.org/tour/regular-expression-patterns.html
--
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]