sabbasani commented on code in PR #12726:
URL: https://github.com/apache/gluten/pull/12726#discussion_r4254440811
##########
backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHIteratorApi.scala:
##########
@@ -56,12 +56,18 @@ class CHIteratorApi extends IteratorApi with Logging with
LogLevelUtil {
private def getFileSchema(schema: StructType, names: Seq[String]):
StructType = {
val dataSchema = ArrayBuffer[StructField]()
+ // Use Spark's resolver for pairwise identifier equality.
+ // Under caseSensitive=true the resolver is exact equality; under false it
is
+ // case-insensitive. This is the correct contract for matching schema
field names
+ // to plan output attribute names -- it avoids the normalised-Map approach
which
+ // can silently discard one of two case-variant keys under
case-insensitive mode.
+ val resolver = org.apache.spark.sql.internal.SQLConf.get.resolver
schema.foreach {
field =>
- // case-insensitive schema matching
- val newField = names.find(_.equalsIgnoreCase(field.name)) match {
- case Some(name) => StructField(name, field.dataType, field.nullable,
field.metadata)
- case _ => field
+ val newField = names.find(n => resolver(n, field.name)) match {
Review Comment:
yeah changed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]