This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch branch-3.4
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.4 by this push:
     new 7f1b6fe02bd [SPARK-42429][BUILD] Fix a sbt compile error for 
`getArgument` when using IntelliJ
7f1b6fe02bd is described below

commit 7f1b6fe02bdb2c68d5fb3129684ca0ed2ae5b534
Author: Zhen Li <[email protected]>
AuthorDate: Tue Feb 14 16:55:54 2023 +0900

    [SPARK-42429][BUILD] Fix a sbt compile error for `getArgument` when using 
IntelliJ
    
    ### What changes were proposed in this pull request?
    When build with IntelliJ, I hit the following error from time to time:
    ```
    
spark/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala:149:18
    value getArgument is not a member of org.mockito.invocation.InvocationOnMock
          invocation.getArgument[Identifier](0).name match {
    ```
    Sometimes the error can be solved by rebuilt with sbt or maven. But the 
best might be just avoid using the method that causes this compilation error.
    
    ### Why are the changes needed?
    Make the life easier for IDE users.
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    Manual and existing tests
    
    Closes #40004 from zhenlineo/fix-ide-old-errors.
    
    Authored-by: Zhen Li <[email protected]>
    Signed-off-by: Hyukjin Kwon <[email protected]>
    (cherry picked from commit 23dd2c97ab00f13dfc855045047e4902112db793)
    Signed-off-by: Hyukjin Kwon <[email protected]>
---
 .../apache/spark/sql/execution/command/PlanResolutionSuite.scala  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala
index 00d8101df83..44b4166c07a 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala
@@ -147,7 +147,7 @@ class PlanResolutionSuite extends AnalysisTest {
   private val testCat: TableCatalog = {
     val newCatalog = mock(classOf[TableCatalog])
     when(newCatalog.loadTable(any())).thenAnswer((invocation: 
InvocationOnMock) => {
-      invocation.getArgument[Identifier](0).name match {
+      invocation.getArguments()(0).asInstanceOf[Identifier].name match {
         case "tab" => table
         case "tab1" => table1
         case "tab2" => table2
@@ -165,7 +165,7 @@ class PlanResolutionSuite extends AnalysisTest {
   private val v2SessionCatalog: TableCatalog = {
     val newCatalog = mock(classOf[TableCatalog])
     when(newCatalog.loadTable(any())).thenAnswer((invocation: 
InvocationOnMock) => {
-      val ident = invocation.getArgument[Identifier](0)
+      val ident = invocation.getArguments()(0).asInstanceOf[Identifier]
       ident.name match {
         case "v1Table" | "v1Table1" => createV1TableMock(ident)
         case "v1HiveTable" => createV1TableMock(ident, provider = "hive")
@@ -189,7 +189,7 @@ class PlanResolutionSuite extends AnalysisTest {
   private val catalogManagerWithDefault = {
     val manager = mock(classOf[CatalogManager])
     when(manager.catalog(any())).thenAnswer((invocation: InvocationOnMock) => {
-      invocation.getArgument[String](0) match {
+      invocation.getArguments()(0).asInstanceOf[String] match {
         case "testcat" =>
           testCat
         case CatalogManager.SESSION_CATALOG_NAME =>
@@ -207,7 +207,7 @@ class PlanResolutionSuite extends AnalysisTest {
   private val catalogManagerWithoutDefault = {
     val manager = mock(classOf[CatalogManager])
     when(manager.catalog(any())).thenAnswer((invocation: InvocationOnMock) => {
-      invocation.getArgument[String](0) match {
+      invocation.getArguments()(0).asInstanceOf[String] match {
         case "testcat" =>
           testCat
         case name =>


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

Reply via email to