Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-49615] Bugfix: Make ML column schema validation conforms with spark config spark.sql.caseSensitive. #48398

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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 @@ -19,8 +19,10 @@ package org.apache.spark.ml.util

import org.apache.spark.ml.attribute._
import org.apache.spark.ml.linalg.VectorUDT
import org.apache.spark.sql.SparkSession
WeichenXu123 marked this conversation as resolved.
Show resolved Hide resolved
import org.apache.spark.sql.catalyst.util.AttributeNameParser
import org.apache.spark.sql.types._
import org.apache.spark.sql.internal.SQLConf


/**
Expand Down Expand Up @@ -213,11 +215,7 @@ private[spark] object SchemaUtils {
*/
def getSchemaField(schema: StructType, colName: String): StructField = {
val colSplits = AttributeNameParser.parseAttributeName(colName)
var field = schema(colSplits(0))
for (colSplit <- colSplits.slice(1, colSplits.length)) {
field = field.dataType.asInstanceOf[StructType](colSplit)
}
field
schema.findNestedField(colSplits, resolver = SQLConf.get.resolver).get._2
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ case class StructType(fields: Array[StructField]) extends DataType with Seq[Stru
*
* If includeCollections is true, this will return fields that are nested in maps and arrays.
*/
private[sql] def findNestedField(
private[spark] def findNestedField(
fieldNames: Seq[String],
includeCollections: Boolean = false,
resolver: SqlApiAnalysis.Resolver = _ == _,
WeichenXu123 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down