diff options
author | Zheng RuiFeng <ruifengz@foxmail.com> | 2016-09-06 14:20:56 -0700 |
---|---|---|
committer | Joseph K. Bradley <joseph@databricks.com> | 2016-09-06 14:20:56 -0700 |
commit | 8bbb08a3001313b53a5d854ef442d82d4c7e1d5d (patch) | |
tree | 04f1cbb4daa781ee016587eccb04b0704d15790a /mllib/src | |
parent | 7775d9f224e22400c6c8c093652a383f4af66ee0 (diff) | |
download | spark-8bbb08a3001313b53a5d854ef442d82d4c7e1d5d.tar.gz spark-8bbb08a3001313b53a5d854ef442d82d4c7e1d5d.tar.bz2 spark-8bbb08a3001313b53a5d854ef442d82d4c7e1d5d.zip |
[MINOR] Remove unnecessary check in MLSerDe
## What changes were proposed in this pull request?
1, remove unnecessary `require()`, because it will make following check useless.
2, update the error msg.
## How was this patch tested?
no test
Author: Zheng RuiFeng <ruifengz@foxmail.com>
Closes #14972 from zhengruifeng/del_unnecessary_check.
Diffstat (limited to 'mllib/src')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/ml/python/MLSerDe.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/ml/python/MLSerDe.scala b/mllib/src/main/scala/org/apache/spark/ml/python/MLSerDe.scala index 1279c901c5..4b805e1454 100644 --- a/mllib/src/main/scala/org/apache/spark/ml/python/MLSerDe.scala +++ b/mllib/src/main/scala/org/apache/spark/ml/python/MLSerDe.scala @@ -56,9 +56,8 @@ private[spark] object MLSerDe extends SerDeBase with Serializable { } def construct(args: Array[Object]): Object = { - require(args.length == 1) if (args.length != 1) { - throw new PickleException("should be 1") + throw new PickleException("length of args should be 1") } val bytes = getBytes(args(0)) val bb = ByteBuffer.wrap(bytes, 0, bytes.length) @@ -95,7 +94,7 @@ private[spark] object MLSerDe extends SerDeBase with Serializable { def construct(args: Array[Object]): Object = { if (args.length != 4) { - throw new PickleException("should be 4") + throw new PickleException("length of args should be 4") } val bytes = getBytes(args(2)) val n = bytes.length / 8 @@ -143,7 +142,7 @@ private[spark] object MLSerDe extends SerDeBase with Serializable { def construct(args: Array[Object]): Object = { if (args.length != 6) { - throw new PickleException("should be 6") + throw new PickleException("length of args should be 6") } val order = ByteOrder.nativeOrder() val colPtrsBytes = getBytes(args(2)) @@ -187,7 +186,7 @@ private[spark] object MLSerDe extends SerDeBase with Serializable { def construct(args: Array[Object]): Object = { if (args.length != 3) { - throw new PickleException("should be 3") + throw new PickleException("length of args should be 3") } val size = args(0).asInstanceOf[Int] val indiceBytes = getBytes(args(1)) |