Skip to content
Closed
Changes from 2 commits
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 @@ -257,8 +257,16 @@ private[hive] class HiveMetastoreCatalog(sparkSession: SparkSession) extends Log
}
// The inferred schema may have different field names as the table schema, we should respect
// it, but also respect the exprId in table relation output.
assert(result.output.length == relation.output.length &&
result.output.zip(relation.output).forall { case (a1, a2) => a1.dataType == a2.dataType })
assert(result.output.length == relation.output.length,
s"Target table has ${result.output.length} columns, " +
s"but source table has ${relation.output.length} columns. " +
s"It may need to recreate the table ${relation.tableMeta.identifier}")
result.output.zip(relation.output).foreach { case (a1, a2) =>
assert(a1.dataType.sameType(a2.dataType),
s"Data type of column ${a1.name} in target table is ${a1.dataType.typeName}, " +
s"but column ${a2.name} in source table is ${a2.dataType.typeName}. " +
s"It may need to recreate the table ${relation.tableMeta.identifier}")
}
val newOutput = result.output.zip(relation.output).map {
case (a1, a2) => a1.withExprId(a2.exprId)
}
Expand Down