LuciferYang opened a new pull request #29783:
URL: https://github.com/apache/spark/pull/29783


   ### What changes were proposed in this pull request?
   
   This pr fix failed and aborted cases in sql hive-thriftserver module in 
Scala 2.13, the main change of this pr as follow:
   
   - Use `s.c.Seq` instead of `Seq` in `HiveResult` because the input type 
maybe `mutable.ArraySeq`, but `Seq` represent `immutable.Seq` in Scala 2.13.
   
   - Reset classLoader after `HiveMetastoreLazyInitializationSuite` completed 
because context class loader is `NonClosableMutableURLClassLoader`  in 
`HiveMetastoreLazyInitializationSuite` running process, and it propagate to 
`HiveThriftServer2ListenerSuite` trigger following problems in Scala 2.13:
   
   ```
   HiveThriftServer2ListenerSuite:
   *** RUN ABORTED ***
     java.lang.LinkageError: loader constraint violation: loader (instance of 
net/bytebuddy/dynamic/loading/MultipleParentClassLoader) previously initiated 
loading for a different type with name 
"org/apache/hive/service/ServiceStateChangeListener"
     at 
org.mockito.codegen.HiveThriftServer2$MockitoMock$1850222569.<clinit>(Unknown 
Source)
     at 
sun.reflect.GeneratedSerializationConstructorAccessor530.newInstance(Unknown 
Source)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
     at 
org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:48)
     at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)
     at 
org.mockito.internal.creation.instance.ObjenesisInstantiator.newInstance(ObjenesisInstantiator.java:19)
     at 
org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker.createMock(SubclassByteBuddyMockMaker.java:47)
     at 
org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.createMock(ByteBuddyMockMaker.java:25)
     at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:35)
     at org.mockito.internal.MockitoCore.mock(MockitoCore.java:63)
     ...
   ```
   
   After this pr `HiveThriftServer2Suites` and `HiveThriftServer2ListenerSuite` 
was fixed and all 461 test passed
   
   ### Why are the changes needed?
   We need to support a Scala 2.13 build.
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   - Scala 2.12: Pass the Jenkins or GitHub Action
   
   - Scala 2.13: All tests passed.
   
   Do the following:
   
   ```
   dev/change-scala-version.sh 2.13
   mvn clean install -DskipTests -pl sql/hive-thriftserver -am 
-Phive-thriftserver -Pscala-2.13
   mvn test -pl sql/hive-thriftserver -Phive -Phive-thriftserver -Pscala-2.13
   ```
   
   **Before**
   
   ```
   HiveThriftServer2ListenerSuite:
   *** RUN ABORTED ***
   ```
   
   **After**
   
   ```
   
   ```
   


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

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