Skip to content

Commit e815446

Browse files
committed
Cleanup
1 parent 8669d37 commit e815446

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSchemaEvolution.scala

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,25 @@ object ResolveSchemaEvolution extends Rule[LogicalPlan] {
161161

162162
case (ArrayType(currentElementType, _), ArrayType(newElementType, _)) =>
163163
computeSchemaChanges(
164-
currentElementType, newElementType,
165-
fieldPath :+ "element", isByName, error)
164+
currentElementType,
165+
newElementType,
166+
fieldPath :+ "element",
167+
isByName,
168+
error)
166169

167170
case (MapType(currentKeyType, currentValueType, _), MapType(newKeyType, newValueType, _)) =>
168171
val keyChanges = computeSchemaChanges(
169-
currentKeyType, newKeyType,
170-
fieldPath :+ "key", isByName, error)
172+
currentKeyType,
173+
newKeyType,
174+
fieldPath :+ "key",
175+
isByName,
176+
error)
171177
val valueChanges = computeSchemaChanges(
172-
currentValueType, newValueType,
173-
fieldPath :+ "value", isByName, error)
178+
currentValueType,
179+
newValueType,
180+
fieldPath :+ "value",
181+
isByName,
182+
error)
174183
keyChanges ++ valueChanges
175184

176185
case (currentType: AtomicType, newType: AtomicType) if currentType != newType =>
@@ -201,7 +210,7 @@ object ResolveSchemaEvolution extends Rule[LogicalPlan] {
201210
currentFields: Array[StructField],
202211
newFields: Array[StructField],
203212
fieldPath: List[String],
204-
onIncompatible: => Nothing): Array[TableChange] = {
213+
error: => Nothing): Array[TableChange] = {
205214
val currentFieldMap = toFieldMap(currentFields)
206215
val newFieldMap = toFieldMap(newFields)
207216

@@ -210,8 +219,11 @@ object ResolveSchemaEvolution extends Rule[LogicalPlan] {
210219
.filter(f => newFieldMap.contains(f.name))
211220
.flatMap { f =>
212221
computeSchemaChanges(
213-
f.dataType, newFieldMap(f.name).dataType,
214-
fieldPath :+ f.name, isByName = true, onIncompatible)
222+
f.dataType,
223+
newFieldMap(f.name).dataType,
224+
fieldPath :+ f.name,
225+
isByName = true,
226+
error)
215227
}
216228

217229
// Collect newly added fields
@@ -233,12 +245,15 @@ object ResolveSchemaEvolution extends Rule[LogicalPlan] {
233245
currentFields: Array[StructField],
234246
newFields: Array[StructField],
235247
fieldPath: List[String],
236-
onIncompatible: => Nothing): Array[TableChange] = {
248+
error: => Nothing): Array[TableChange] = {
237249
// Update existing field types by pairing fields at the same position.
238250
val updates = currentFields.zip(newFields).flatMap { case (currentField, newField) =>
239251
computeSchemaChanges(
240-
currentField.dataType, newField.dataType,
241-
fieldPath :+ currentField.name, isByName = false, onIncompatible)
252+
currentField.dataType,
253+
newField.dataType,
254+
fieldPath :+ currentField.name,
255+
isByName = false,
256+
error)
242257
}
243258

244259
// Extra source fields beyond the target's field count are new additions.

0 commit comments

Comments
 (0)