You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2025/06/02 02:57:30 UTC

Re: [PR] [SPARK-48356][FOLLOW UP][SQL] Improve FOR statement's column schema inference [spark]

cloud-fan commented on code in PR #51053:
URL: https://github.com/apache/spark/pull/51053#discussion_r2119910596


##########
sql/api/src/main/scala/org/apache/spark/sql/types/StructType.scala:
##########
@@ -122,6 +122,8 @@ case class StructType(fields: Array[StructField]) extends DataType with Seq[Stru
   private lazy val nameToIndex: Map[String, Int] = SparkCollectionUtils.toMapWithIndex(fieldNames)
   private lazy val nameToIndexCaseInsensitive: CaseInsensitiveMap[Int] =
     CaseInsensitiveMap[Int](nameToIndex.toMap)
+  lazy val nameToDataType: collection.immutable.Map[String, DataType] =

Review Comment:
   `StructType` is a public API, we should only add new methods when we have to. It's also in the Spark Connect side, which means users need to upgrade the client version.
   
   Can we build this map in the caller side?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org