Skip to content

Commit aa9c391

Browse files
committed
Add pyUDT to MatrixUDT
1 parent 62a2a7d commit aa9c391

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ private[spark] class MatrixUDT extends UserDefinedType[Matrix] {
197197

198198
override def typeName: String = "matrix"
199199

200+
override def pyUDT: String = "pyspark.mllib.linalg.MatrixUDT"
201+
200202
private[spark] override def asNullable: MatrixUDT = this
201203
}
202204

python/pyspark/mllib/linalg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def serialize(self, obj):
199199
return (1, obj.numRows, obj.numCols, None, None, values,
200200
bool(obj.isTransposed))
201201
else:
202-
raise TypeError("cannot serialize %r of type %r" % (obj, type(obj)))
202+
raise TypeError("cannot serialize type %r" % (type(obj)))
203203

204204
def deserialize(self, datum):
205205
assert len(datum) == 7, \

python/pyspark/mllib/tests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ class MatrixUDTTests(MLlibTestCase):
513513
dm2 = DenseMatrix(3, 2, [0, 1, 4, 5, 9, 10], isTransposed=True)
514514
sm1 = SparseMatrix(1, 1, [0, 1], [0], [2.0])
515515
sm2 = SparseMatrix(2, 1, [0, 0, 1], [0], [5.0], isTransposed=True)
516-
517516
udt = MatrixUDT()
518517

519518
def test_json_schema(self):

0 commit comments

Comments
 (0)