Github user marmbrus commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10311#discussion_r47819590
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala 
---
    @@ -740,4 +696,26 @@ trait ScalaReflection {
         assert(methods.length == 1)
         methods.head.getParameterTypes
       }
    +
    +  protected def getConstructorParas(tpe: Type): Seq[(String, Type)] = {
    +    val formalTypeArgs = tpe.typeSymbol.asClass.typeParams
    +    val TypeRef(_, _, actualTypeArgs) = tpe
    +    val constructorSymbol = tpe.member(nme.CONSTRUCTOR)
    +    val params = if (constructorSymbol.isMethod) {
    +      constructorSymbol.asMethod.paramss
    +    } else {
    +      // Find the primary constructor, and use its parameter ordering.
    +      val primaryConstructorSymbol: Option[Symbol] = 
constructorSymbol.asTerm.alternatives.find(
    +        s => s.isMethod && s.asMethod.isPrimaryConstructor)
    +      if (primaryConstructorSymbol.isEmpty) {
    +        sys.error("Internal SQL error: Product object did not have a 
primary constructor.")
    +      } else {
    +        primaryConstructorSymbol.get.asMethod.paramss
    +      }
    +    }
    +
    +    params.flatten.map { p =>
    --- End diff --
    
    Can you double check that this doesn't cause problems with inner classes 
(like in the REPL).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to