cloud-fan commented on a change in pull request #34400:
URL: https://github.com/apache/spark/pull/34400#discussion_r737528352



##########
File path: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
##########
@@ -244,6 +245,18 @@ private[client] sealed abstract class Shim {
   protected def findMethod(klass: Class[_], name: String, args: Class[_]*): 
Method = {
     klass.getMethod(name, args: _*)
   }
+
+  protected def withHiveCall[A](f: => A): A = {
+    withHiveCall(1)(f)
+  }
+
+  protected def withHiveCall[A](numCalls: Int = 1)(f: => A): A = {
+    try {
+      f
+    } finally {
+      HiveCatalogMetrics.incrementHiveClientCalls(numCalls)

Review comment:
       seems simpler to do
   ```
   HiveCatalogMetrics.incrementHiveClientCalls(numCalls)
   f
   ```
   
   since `incrementHiveClientCalls` won't fail.




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