vladimirg-db commented on code in PR #53729:
URL: https://github.com/apache/spark/pull/53729#discussion_r2675860664
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala:
##########
@@ -1301,29 +1301,43 @@ object Expand {
* @param groupByAttrs The attributes of aliased group by expressions
* @param gid Attribute of the grouping id
* @param child Child operator
+ * @param childOutputOpt Optional child output. If not provided, then
`child.output` is used
*/
def apply(
groupingSetsAttrs: Seq[Seq[Attribute]],
groupByAliases: Seq[Alias],
groupByAttrs: Seq[Attribute],
gid: Attribute,
- child: LogicalPlan): Expand = {
+ child: LogicalPlan,
+ childOutputOpt: Option[Seq[Attribute]] = None): Expand = {
+ val childOutput = childOutputOpt.getOrElse(child.output)
+
val attrMap = Utils.toMapWithIndex(groupByAttrs)
val hasDuplicateGroupingSets = groupingSetsAttrs.size !=
groupingSetsAttrs.map(_.map(_.exprId).toSet).distinct.size
+ // Compute nullabilities from childOutput ++ groupByAliases to fix the
nullable field
+ val nullabilities = (childOutput ++
groupByAliases.map(_.toAttribute)).groupBy(_.exprId).map {
Review Comment:
- What is the case that are we actually "fixing" here?
- Is this a noop for fixed-point or are we introducing a logic change?
- Can you please explain the semantic of the change in the method doc
instead of the inline docs?
--
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]