You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "LuciferYang (via GitHub)" <gi...@apache.org> on 2023/10/01 14:42:05 UTC

[GitHub] [spark] LuciferYang commented on a diff in pull request #43189: [SPARK-45388][SQL][HIVE] Eliminate unnecessary reflection invocation in Hive shim classes

LuciferYang commented on code in PR #43189:
URL: https://github.com/apache/spark/pull/43189#discussion_r1342145839


##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala:
##########
@@ -266,56 +257,8 @@ private[client] class Shim_v2_0 extends Shim with Logging {
   // txnId can be 0 unless isAcid == true
   protected lazy val txnIdInLoadDynamicPartitions: JLong = 0L
 
-  protected lazy val getMSCMethod = {
-    // Since getMSC() in Hive 0.12 is private, findMethod() could not work here
-    val msc = classOf[Hive].getDeclaredMethod("getMSC")
-    msc.setAccessible(true)
-    msc
-  }
-
-  override def getMSC(hive: Hive): IMetaStoreClient = {
-    getMSCMethod.invoke(hive).asInstanceOf[IMetaStoreClient]
-  }
+  override def getMSC(hive: Hive): IMetaStoreClient = hive.getMSC

Review Comment:
   Which approach is better, providing a default implementation in the template class `abstract class Shim` or `override` in the specific class?



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org