HyukjinKwon commented on a change in pull request #25736: [SPARK-29026][SQL]
Improve error message when constructor in `ScalaReflection` isn't found
URL: https://github.com/apache/spark/pull/25736#discussion_r322516397
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala
##########
@@ -906,7 +906,13 @@ trait ScalaReflection extends Logging {
* only defines a constructor via `apply` method.
*/
private def getCompanionConstructor(tpe: Type): Symbol = {
-
tpe.typeSymbol.asClass.companion.asTerm.typeSignature.member(universe.TermName("apply"))
+ tpe.typeSymbol.asClass.companion match {
+ case NoSymbol =>
+ throw new UnsupportedOperationException(s"Unable to find constructor
for $tpe. " +
+ s"This could happen if $tpe is an interface, or a trait without
companion object " +
+ s"constructor.")
Review comment:
leading `s` seems not needed.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]