Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@
"subClass" : {
"ATTRIBUTE_NOT_ALLOWED" : {
"message" : [
"<attribute> is not allowed to be accessed."
"<attribute> in <className> is not allowed to be accessed."
]
},
"UNSUPPORTED_EXCEPTION" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ private[spark] case class MlUnsupportedException(message: String)
messageParameters = Map("message" -> message),
cause = null)

private[spark] case class MLAttributeNotAllowedException(attribute: String)
private[spark] case class MLAttributeNotAllowedException(className: String, attribute: String)
extends SparkException(
errorClass = "CONNECT_ML.ATTRIBUTE_NOT_ALLOWED",
messageParameters = Map("attribute" -> attribute),
messageParameters = Map("className" -> className, "attribute" -> attribute),
cause = null)
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ private[ml] object MLUtils {
cls.isInstance(obj) && methods.contains(method)
}
if (!valid) {
throw MLAttributeNotAllowedException(method)
throw MLAttributeNotAllowedException(obj.getClass.getName, method)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,12 @@ class MLSuite extends MLHelper {
val modelId = trainLogisticRegressionModel(sessionHolder)

val fakeAttributeCmd = fetchCommand(modelId, "notExistingAttribute")
intercept[MLAttributeNotAllowedException] {
val e = intercept[MLAttributeNotAllowedException] {
MLHandler.handleMlCommand(sessionHolder, fakeAttributeCmd)
}
val msg = e.getMessage
assert(msg.contains("notExistingAttribute"))
assert(msg.contains("org.apache.spark.ml.classification.LogisticRegressionModel"))
}

test("Model must be registered into ServiceLoader when loading") {
Expand Down