Skip to content

Commit 050bb97

Browse files
committed
Skip no-arg constructors for kryo,
1 parent bd08239 commit 050bb97

File tree

1 file changed

+2
-1
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees

1 file changed

+2
-1
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ abstract class TreeNode[BaseType <: TreeNode[BaseType]] {
280280
*/
281281
def makeCopy(newArgs: Array[AnyRef]): this.type = attachTree(this, "makeCopy") {
282282
try {
283-
val defaultCtor = getClass.getConstructors.head
283+
// Skip no-arg constructors that are just there for kryo.
284+
val defaultCtor = getClass.getConstructors.find(_.getParameterTypes.size != 0).head
284285
if (otherCopyArgs.isEmpty) {
285286
defaultCtor.newInstance(newArgs: _*).asInstanceOf[this.type]
286287
} else {

0 commit comments

Comments
 (0)