Github user thunterdb commented on a diff in the pull request:
https://github.com/apache/spark/pull/10472#discussion_r48993376
--- Diff: mllib/src/main/scala/org/apache/spark/ml/util/SchemaUtils.scala
---
@@ -44,6 +44,23 @@ private[spark] object SchemaUtils {
}
/**
+ * Check whether the given schema contains a column of one of the
require data types.
+ * @param colName column name
+ * @param dataTypes required column data types
+ */
+ def checkColumnTypes(
+ schema: StructType,
+ colName: String,
+ dataTypes: Seq[DataType],
+ msg: String = ""): Unit = {
+ val actualDataType = schema(colName).dataType
+ val message = if (msg != null && msg.trim.length > 0) " " + msg else ""
+ require(dataTypes.exists(actualDataType.equals(_)),
--- End diff --
You do not need the `_`: `dataTypes.exists(actualDataType.equals)`
---
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]