Consider this test in UserDefinedTypeSuite:
I claim the last two lines can't be right, because they say that the first column in the aggregation is the vector, when it is the grouping key (int). But it passes!
But it started failing when I made seemingly unrelated changes in https://github.com/apache/spark/pull/18645 like:
I modified the test to actually assert that the vector that results in each case is the expected one, and it began failing with the same error, in master. Therefore I am pretty sure the test is not quite doing what it seems to want to, and the result of these expressions just happened to not be fully evaluated or checked.
CC Michael Armbrust for the discussion at https://github.com/apache/spark/commit/3ae25f244bd471ef77002c703f2cc7ed6b524f11##commitcomment-23320234 and apologies if I'm still really missing something here. I'll open a PR to show you what I mean.