AngersZhuuuu commented on a change in pull request #34400:
URL: https://github.com/apache/spark/pull/34400#discussion_r737663719
##########
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:
> Actually, maybe it's clearer to do
>
> ```
> def recordHiveCall() {
> HiveCatalogMetrics.incrementHiveClientCalls(1)
> }
> ```
>
> And then call this method before any `hive.xxx` calls.
updated, but why not just use
```
HiveCatalogMetrics.incrementHiveClientCalls(1)
```
--
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]