Skip to content

Commit

Permalink
[GLUTEN-5852][CH] fix mismatch result columns size exception (#5853)
Browse files Browse the repository at this point in the history
  • Loading branch information
shuai-xu authored May 29, 2024
1 parent 123c136 commit f10d3b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,11 @@ class GlutenClickhouseCountDistinctSuite extends GlutenClickHouseWholeStageTrans
}
)
}

test("GLUTEN-5852: Fix mismatch result columns size exception related to 5618") {
val sql =
"select distinct * from (select 2 as r3, count(distinct a, b, c), 2 as r1, 2 as r2 from " +
"values (0, null, 1), (1, 1, 1), (2, 2, 1), (1, 2, 1) ,(2, 2, 2) as data(a,b,c) group by c)"
compareResultsAgainstVanillaSpark(sql, true, { _ => })
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ trait PullOutProjectHelper {
replaceBoundReference: Boolean = false): Expression =
expr match {
case alias: Alias =>
projectExprsMap.getOrElseUpdate(alias.child.canonicalized, alias).toAttribute
alias.child match {
case _: Literal =>
projectExprsMap.getOrElseUpdate(alias, alias).toAttribute
case _ =>
projectExprsMap.getOrElseUpdate(alias.child.canonicalized, alias).toAttribute
}
case attr: Attribute => attr
case e: BoundReference if !replaceBoundReference => e
case other =>
Expand Down

0 comments on commit f10d3b7

Please sign in to comment.