You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "ksbeyer (via GitHub)" <gi...@apache.org> on 2025/08/14 20:15:19 UTC
Re: [PR] [SPARK-52677] Simplify DataTypeUtils.canWrite and TableOutputResolver [spark]
ksbeyer commented on code in PR #52016:
URL: https://github.com/apache/spark/pull/52016#discussion_r2277634882
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TableOutputResolver.scala:
##########
@@ -244,35 +215,57 @@ object TableOutputResolver extends SQLConfHelper with Logging {
}
}
-
- private def canWrite(
+ private def verifyCanWrite(
tableName: String,
valueType: DataType,
expectedType: DataType,
byName: Boolean,
conf: SQLConf,
- addError: String => Unit,
- colPath: Seq[String]): Boolean = {
+ colPath: Seq[String]): Unit = {
conf.storeAssignmentPolicy match {
case StoreAssignmentPolicy.STRICT | StoreAssignmentPolicy.ANSI =>
- DataTypeUtils.canWrite(
+ DataTypeUtils.verifyCanWrite(
tableName, valueType, expectedType, byName, conf.resolver, colPath.quoted,
- conf.storeAssignmentPolicy, addError)
+ conf.storeAssignmentPolicy)
case _ =>
- true
+ // LEGACY store assignment policy is disallowed in data source v2.
+ // todo: Is this method used by v1? Should it verify LEGACY writes? or block them?
Review Comment:
removed todo and added comment
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TableOutputResolver.scala:
##########
@@ -244,35 +215,57 @@ object TableOutputResolver extends SQLConfHelper with Logging {
}
}
-
- private def canWrite(
+ private def verifyCanWrite(
tableName: String,
valueType: DataType,
expectedType: DataType,
byName: Boolean,
conf: SQLConf,
- addError: String => Unit,
- colPath: Seq[String]): Boolean = {
+ colPath: Seq[String]): Unit = {
conf.storeAssignmentPolicy match {
case StoreAssignmentPolicy.STRICT | StoreAssignmentPolicy.ANSI =>
- DataTypeUtils.canWrite(
+ DataTypeUtils.verifyCanWrite(
tableName, valueType, expectedType, byName, conf.resolver, colPath.quoted,
- conf.storeAssignmentPolicy, addError)
+ conf.storeAssignmentPolicy)
case _ =>
- true
+ // LEGACY store assignment policy is disallowed in data source v2.
+ // todo: Is this method used by v1? Should it verify LEGACY writes? or block them?
}
}
+ private def resolveColumns(tableName: String,
+ inputCols: Seq[NamedExpression],
+ expectedCols: Seq[Attribute],
+ conf: SQLConf,
+ byName: Boolean,
+ fillDefaultValue: Boolean,
+ colPath: Seq[String] = Nil): Seq[NamedExpression] = {
Review Comment:
done
--
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