You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "xil-db (via GitHub)" <gi...@apache.org> on 2024/09/17 19:16:56 UTC
Re: [PR] [SPARK-49679][SQL] validateSchemaOutput should refer to case sensitivity flag [spark]
xil-db commented on code in PR #48127:
URL: https://github.com/apache/spark/pull/48127#discussion_r1763777762
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/LogicalPlan.scala:
##########
@@ -416,12 +417,22 @@ object LogicalPlanIntegrity {
}
def validateSchemaOutput(previousPlan: LogicalPlan, currentPlan: LogicalPlan): Option[String] = {
- if (!DataTypeUtils.equalsIgnoreNullability(previousPlan.schema, currentPlan.schema)) {
- Some(s"The plan output schema has changed from ${previousPlan.schema.sql} to " +
- currentPlan.schema.sql + s". The previous plan: ${previousPlan.treeString}\nThe new " +
- "plan:\n" + currentPlan.treeString)
+ if (SqlApiConf.get.caseSensitiveAnalysis) {
+ if (!DataTypeUtils.equalsIgnoreNullability(previousPlan.schema, currentPlan.schema)) {
+ Some(s"The plan output schema has changed from ${previousPlan.schema.sql} to " +
+ currentPlan.schema.sql + s". The previous plan: ${previousPlan.treeString}\nThe new " +
+ "plan:\n" + currentPlan.treeString)
+ } else {
+ None
+ }
} else {
- None
+ if (!DataTypeUtils.equalsIgnoreCaseAndNullability(previousPlan.schema, currentPlan.schema)) {
+ Some(s"The plan output schema has changed from ${previousPlan.schema.sql} to " +
+ currentPlan.schema.sql + s". The previous plan: ${previousPlan.treeString}\nThe new " +
+ "plan:\n" + currentPlan.treeString)
+ } else {
+ None
+ }
Review Comment:
can we avoid duplicating the error messages?
maybe something like
```
val isValid = if(SqlApiConf.get.caseSensitiveAnalysis) {...} else {...}
if (!isValid) { Some(...) } else { None }
```
--
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