Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,7 @@ public void materializeRequiredSlots(Analyzer analyzer, ExprSubstitutionMap smap
continue;
}

slotDesc.setIsMaterialized(true);
intermediateSlotDesc.setIsMaterialized(true);
exprs.add(functionCallExpr);
materializedSlots.add(i);
Expand Down
3 changes: 3 additions & 0 deletions regression-test/data/correctness_p0/test_agg_materialize.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
-- !select --
3

-- !select2 --
1
qycs
69 changes: 69 additions & 0 deletions regression-test/suites/correctness_p0/test_agg_materialize.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,73 @@ suite("test_agg_materialize") {
from tb1
where e1 = 1)tttt
; """
sql """drop table if exists c5749_bug_t;"""
sql """CREATE TABLE `c5749_bug_t` (
`org_code` varchar(255) NULL ,
`cash_amt` decimal(27, 9) NULL ,

) ENGINE=OLAP
DUPLICATE KEY(`org_code`)
DISTRIBUTED BY HASH(`org_code`) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2",
"disable_auto_compaction" = "false"
);"""
sql """insert into c5749_bug_t values('1',1), ('1',2);"""
qt_select2 """with SPJ AS (
WITH TOTAL AS (
SELECT
t1.org_code,
round(ifnull(sum(t1.qty), 0) / 10000, 2) qty
FROM
(
SELECT
parentOrg.org_code,
SUM(parentOrg.cash_amt) qty
FROM
c5749_bug_t parentOrg
GROUP BY
parentOrg.org_code
UNION
ALL
SELECT
parentOrg.org_code,
SUM(parentOrg.cash_amt) qty
FROM
c5749_bug_t parentOrg
GROUP BY
parentOrg.org_code
) t1
GROUP BY
t1.org_code
),
AGG AS (
SELECT
TOTAL.org_code,
TOTAL.qty totalQty
FROM
TOTAL
UNION
ALL
SELECT
'qycs' org_code,
SUM(TOTAL.qty) totalQty
FROM
TOTAL
)
SELECT
AGG.org_code,
AGG.totalQty AS totalQty
FROM
AGG
)
SELECT
SPJ.org_code
FROM
SPJ
ORDER BY SPJ.org_code;
"""
sql """drop table if exists c5749_bug_t;"""
}