flipp5b commented on code in PR #57243:
URL: https://github.com/apache/spark/pull/57243#discussion_r3581866546
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala:
##########
@@ -648,11 +648,13 @@ object PartitioningUtils extends SQLConfHelper {
* Given a collection of [[Literal]]s, resolves possible type conflicts by
* [[findWiderTypeForPartitionColumn]].
*/
- private def resolveTypeConflicts(typedValues: Seq[TypedPartValue]):
Seq[TypedPartValue] = {
+ private def resolveTypeConflicts(typedValues: Seq[TypedPartValue]):
IndexedSeq[TypedPartValue] = {
val dataTypes = typedValues.map(_.dataType)
val desiredType = dataTypes.reduce(findWiderTypeForPartitionColumn)
- typedValues.map(tv => tv.copy(dataType = desiredType))
+ // Returns IndexedSeq to guarantee O(1) element access at the call site.
+ // A linear Seq (like List) would cause O(n) lookups, making the
subsequent loop O(n²).
Review Comment:
Sure, done!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]