Merge pull request #57795 from CurtizJ/fix-totals-maxMap

Fix merge in aggregation functions with `*Map` combinator
This commit is contained in:
robot-ch-test-poll1 2023-12-13 10:31:15 +01:00 committed by GitHub
commit c2f32f5994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 91 additions and 82 deletions

View File

@ -254,11 +254,20 @@ public:
if (it != merged_maps.end())
{
for (size_t col = 0; col < values_types.size(); ++col)
{
if (!elem.second[col].isNull())
applyVisitor(Visitor(elem.second[col]), it->second[col]);
{
if (it->second[col].isNull())
it->second[col] = elem.second[col];
else
applyVisitor(Visitor(elem.second[col]), it->second[col]);
}
}
}
else
{
merged_maps[elem.first] = elem.second;
}
}
}

View File

@ -1,119 +1,119 @@
([-1,0],[0,0])
([1,2],[0,2])
([0,1],[0,1])
([1,2],[0,2])
([-1,0,1,2],[0,0,0,2])
([-1,0,1,2],[0,0,1,2])
([-1,0],[0,0])
([1,2],[0,2])
([-1,0,1,2],[0,0,1,2])
([0,1],[0,1])
([-1,0,1,2],[0,0,0,2])
([1,2],[0,2])
([-1,0],[0,0])
([1,2],[0,2])
([-1,0,1,2],[0,0,1,2])
([0,1],[0,1])
([-1,0,1,2],[0,0,0,2])
([1,2],[0,2])
([-1,0],[0,0])
([1,2],[0,2])
([0,1],[0,1])
([1,2],[0,2])
([-1,0,1,2],[0,0,0,2])
([-1,0,1,2],[0,0,1,2])
([-1,0],[0,0])
([1,2],[0,2])
([-1,0,1,2],[0,0,1,2])
([0,1],[0,1])
([-1,0,1,2],[0,0,0,2])
([1,2],[0,2])
([-1,0],[0,0])
([1,2],[0,2])
([-1,0,1,2],[0,0,1,2])
([0,1],[0,1])
([-1,0,1,2],[0,0,0,2])
([1,2],[0,2])
([0],[0])
([2],[2])
([1],[1])
([2],[2])
([0,2],[0,2])
([0,1,2],[0,1,2])
([0],[0])
([2],[2])
([0,1,2],[0,1,2])
([1],[1])
([0,2],[0,2])
([2],[2])
([0],[0])
([2],[2])
([0,1,2],[0,1,2])
([1],[1])
([0,2],[0,2])
([2],[2])
-
([-1,0],[0,0])
([1,2],[0,2])
([0,1],[0,1])
([1,2],[0,2])
([-1,0,1,2],[0,0,0,2])
([-1,0,1,2],[0,0,1,2])
([-1,0],[0,0])
([1,2],[0,2])
([-1,0,1,2],[0,0,1,2])
([0,1],[0,1])
([-1,0,1,2],[0,0,0,2])
([1,2],[0,2])
([-1,0],[0,0])
([1,2],[0,2])
([-1,0,1,2],[0,0,1,2])
([0,1],[0,1])
([-1,0,1,2],[0,0,0,2])
([1,2],[0,2])
([-1,0],[0,0])
([1,2],[0,2])
([0,1],[0,1])
([1,2],[0,2])
([-1,0,1,2],[0,0,0,2])
([-1,0,1,2],[0,0,1,2])
([-1,0],[0,0])
([1,2],[0,2])
([-1,0,1,2],[0,0,1,2])
([0,1],[0,1])
([-1,0,1,2],[0,0,0,2])
([1,2],[0,2])
([-1,0],[0,0])
([1,2],[0,2])
([-1,0,1,2],[0,0,1,2])
([0,1],[0,1])
([-1,0,1,2],[0,0,0,2])
([1,2],[0,2])
([0],[0])
([2],[2])
([1],[1])
([2],[2])
([0,2],[0,2])
([0,1,2],[0,1,2])
([0],[0])
([2],[2])
([0,1,2],[0,1,2])
([1],[1])
([0,2],[0,2])
([2],[2])
([0],[0])
([2],[2])
([0,1,2],[0,1,2])
([1],[1])
([0,2],[0,2])
([2],[2])
-
([-1,0],[0,0])
([1,2],[0,2])
([0,1],[0,1])
([1,2],[0,2])
([-1,0,1,2],[0,0,0,2])
([-1,0,1,2],[0,0,1,2])
([-1,0],[0,0])
([1,2],[0,2])
([-1,0,1,2],[0,0,1,2])
([0,1],[0,1])
([-1,0,1,2],[0,0,0,2])
([1,2],[0,2])
([-1,0],[0,0])
([1,2],[0,2])
([-1,0,1,2],[0,0,1,2])
([0,1],[0,1])
([-1,0,1,2],[0,0,0,2])
([1,2],[0,2])
([-1,0],[0,0])
([1,2],[0,2])
([0,1],[0,1])
([1,2],[0,2])
([-1,0,1,2],[0,0,0,2])
([-1,0,1,2],[0,0,1,2])
([-1,0],[0,0])
([1,2],[0,2])
([-1,0,1,2],[0,0,1,2])
([0,1],[0,1])
([-1,0,1,2],[0,0,0,2])
([1,2],[0,2])
([-1,0],[0,0])
([1,2],[0,2])
([-1,0,1,2],[0,0,1,2])
([0,1],[0,1])
([-1,0,1,2],[0,0,0,2])
([1,2],[0,2])
([0],[0])
([2],[2])
([1],[1])
([2],[2])
([0,2],[0,2])
([0,1,2],[0,1,2])
([0],[0])
([2],[2])
([0,1,2],[0,1,2])
([1],[1])
([0,2],[0,2])
([2],[2])
([0],[0])
([2],[2])
([0,1,2],[0,1,2])
([1],[1])
([0,2],[0,2])
([2],[2])

View File

@ -1,39 +1,39 @@
SELECT maxMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS;
SELECT maxMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP;
SELECT maxMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH CUBE;
SELECT maxMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS ORDER BY number;
SELECT maxMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP ORDER BY number;
SELECT maxMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH CUBE ORDER BY number;
SELECT minMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS;
SELECT minMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP;
SELECT minMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH CUBE;
SELECT minMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS ORDER BY number;
SELECT minMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP ORDER BY number;
SELECT minMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH CUBE ORDER BY number;
SELECT sumMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS;
SELECT sumMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP;
SELECT sumMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH CUBE;
SELECT sumMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS ORDER BY number;
SELECT sumMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP ORDER BY number;
SELECT sumMap([number % 3, number % 4 - 1], [number, NULL]) FROM numbers(3) GROUP BY number WITH CUBE ORDER BY number;
SELECT '-';
SELECT maxMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS;
SELECT maxMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP;
SELECT maxMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH CUBE;
SELECT maxMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS ORDER BY number;
SELECT maxMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP ORDER BY number;
SELECT maxMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH CUBE ORDER BY number;
SELECT minMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS;
SELECT minMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP;
SELECT minMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH CUBE;
SELECT minMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS ORDER BY number;
SELECT minMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP ORDER BY number;
SELECT minMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH CUBE ORDER BY number;
SELECT sumMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS;
SELECT sumMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP;
SELECT sumMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH CUBE;
SELECT sumMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS ORDER BY number;
SELECT sumMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP ORDER BY number;
SELECT sumMap([number % 3, number % 4 - 1], [number :: Float64, NULL]) FROM numbers(3) GROUP BY number WITH CUBE ORDER BY number;
SELECT '-';
SELECT maxMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS;
SELECT maxMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP;
SELECT maxMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH CUBE;
SELECT maxMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS ORDER BY number;
SELECT maxMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP ORDER BY number;
SELECT maxMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH CUBE ORDER BY number;
SELECT minMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS;
SELECT minMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP;
SELECT minMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH CUBE;
SELECT minMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS ORDER BY number;
SELECT minMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP ORDER BY number;
SELECT minMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH CUBE ORDER BY number;
SELECT sumMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS;
SELECT sumMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP;
SELECT sumMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH CUBE;
SELECT sumMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH TOTALS ORDER BY number;
SELECT sumMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH ROLLUP ORDER BY number;
SELECT sumMap([number % 3, number % 4 - 1], [number :: UInt256, NULL]) FROM numbers(3) GROUP BY number WITH CUBE ORDER BY number;