EnricoMi commented on code in PR #36150:
URL: https://github.com/apache/spark/pull/36150#discussion_r927497754


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala:
##########
@@ -736,6 +736,22 @@ abstract class TypeCoercionBase {
     }
   }
 
+  /**
+   * Determines the value type of a [[Unpivot]].
+   */
+  object UnpivotCoercion extends Rule[LogicalPlan] {

Review Comment:
   Yes, most other rules in that file are `TypeCoercionRule`, except for 
`WidenSetOperationTypes`.
   
   Like `WidenSetOperationTypes`, `UnpivotCoercion` handles expressions of 
specific `LogicalPlan`s only (to be precise the `values` expression of 
`Unpivot` `LogicalPlan` only), not any expression of some kind. So I think it 
has to hook into `Rule[LogicalPlan].apply` rather than 
`TypeCoercionRule.transform`.
   
   I have moved `UnpivotCoercion` in that file next to `WidenSetOperationTypes` 
as they are similar in that sense.



-- 
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]

Reply via email to