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-49679][SQL] validateSchemaOutput should refer to case sensitivity flag #48127

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
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 @@ -31,6 +31,7 @@ import org.apache.spark.sql.catalyst.trees.TreePattern.{LOGICAL_QUERY_STAGE, Tre
import org.apache.spark.sql.catalyst.types.DataTypeUtils
import org.apache.spark.sql.catalyst.util.MetadataColumnHelper
import org.apache.spark.sql.errors.{QueryCompilationErrors, QueryExecutionErrors}
import org.apache.spark.sql.internal.SqlApiConf
import org.apache.spark.sql.types.{DataType, StructType}


Expand Down Expand Up @@ -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
}
averyqi-db marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down