Skip to content

Commit

Permalink
change .filter to .find
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeep-katta committed Apr 16, 2021
1 parent baf8125 commit 04b24c9
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ object SchemaPruning extends SQLConfHelper {
val filteredRightFieldNames = rightStruct.fieldNames
.filter(name => leftStruct.fieldNames.exists(resolver(_, name)))
val sortedLeftFields = filteredRightFieldNames.map { fieldName =>
val resolvedLeftStruct = leftStruct.filter(p => resolver(p.name, fieldName)).head
val resolvedLeftStruct = leftStruct.find(p => resolver(p.name, fieldName)).get
val leftFieldType = resolvedLeftStruct.dataType
val rightFieldType = rightStruct(fieldName).dataType
val sortedLeftFieldType = sortLeftFieldsByRight(leftFieldType, rightFieldType)
Expand Down

0 comments on commit 04b24c9

Please sign in to comment.