Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Weichen Xu <[email protected]>
  • Loading branch information
WeichenXu123 committed Oct 10, 2024
1 parent 8a03a3b commit b16d64a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.spark.ml.util

import org.apache.spark.SparkIllegalArgumentException
import org.apache.spark.ml.attribute._
import org.apache.spark.ml.linalg.VectorUDT
import org.apache.spark.sql.catalyst.util.AttributeNameParser
Expand Down Expand Up @@ -214,7 +215,11 @@ private[spark] object SchemaUtils {
*/
def getSchemaField(schema: StructType, colName: String): StructField = {
val colSplits = AttributeNameParser.parseAttributeName(colName)
schema.findNestedField(colSplits, resolver = SQLConf.get.resolver).get._2
val fieldOpt = schema.findNestedField(colSplits, resolver = SQLConf.get.resolver)
if (fieldOpt.isEmpty) {
throw new SparkIllegalArgumentException("FIELD_NOT_FOUND")
}
fieldOpt.get._2
}

/**
Expand Down

0 comments on commit b16d64a

Please sign in to comment.