Skip to content

Commit 5a00e66

Browse files
committed
Add assertions in order to reproduce SPARK-7858
1 parent 8ba195c commit 5a00e66

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/ExistingRDD.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ object RDDConversions {
3838
} else {
3939
val bufferedIterator = iterator.buffered
4040
val mutableRow = new SpecificMutableRow(schema.fields.map(_.dataType))
41-
val schemaFields = schema.fields.toArray
41+
val schemaFields = schema.fields
42+
assert(mutableRow.length == schemaFields.length,
43+
s"Input row has ${mutableRow.length} fields but schema has ${schemaFields.length}")
4244
val converters = schemaFields.map {
4345
f => CatalystTypeConverters.createToCatalystConverter(f.dataType)
4446
}
@@ -65,7 +67,9 @@ object RDDConversions {
6567
} else {
6668
val bufferedIterator = iterator.buffered
6769
val mutableRow = new GenericMutableRow(bufferedIterator.head.toSeq.toArray)
68-
val schemaFields = schema.fields.toArray
70+
val schemaFields = schema.fields
71+
assert(mutableRow.length == schemaFields.length,
72+
s"Input row has ${mutableRow.length} fields but schema has ${schemaFields.length}")
6973
val converters = schemaFields.map {
7074
f => CatalystTypeConverters.createToCatalystConverter(f.dataType)
7175
}

0 commit comments

Comments
 (0)