-
Notifications
You must be signed in to change notification settings - Fork 610
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix typing for block decimal avg (use logic of non-block version) (#9327
- Loading branch information
Showing
11 changed files
with
244 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
ydb/library/yql/tests/sql/suites/agg_phases_agg_apply/avg_decimal.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* syntax version 1 */ | ||
/* postgres can not */ | ||
pragma EmitAggApply; | ||
|
||
$t = SELECT * FROM AS_TABLE([<|key: 1, value: decimal("2.1", 7, 2)|>,<|key: 1, value: decimal("3.5", 7, 2)|>]); | ||
|
||
$p = | ||
SELECT | ||
key,avg(value) as a | ||
FROM $t | ||
GROUP BY | ||
key | ||
with combine | ||
; | ||
|
||
$p = PROCESS $p; | ||
--select FormatType(TypeOf($p)); | ||
select * from $p; | ||
|
||
$p = SELECT | ||
key,avg(a) as a | ||
FROM $p | ||
GROUP BY | ||
key | ||
with combinestate | ||
; | ||
|
||
$p = PROCESS $p; | ||
--select FormatType(TypeOf($p)); | ||
select * from $p; | ||
|
||
$p = SELECT | ||
key,avg(a) as a | ||
FROM $p | ||
GROUP BY | ||
key | ||
with mergestate | ||
; | ||
|
||
$p = PROCESS $p; | ||
--select FormatType(TypeOf($p)); | ||
select * from $p; | ||
|
||
|
||
$p1 = SELECT | ||
key,avg(a) as a | ||
FROM $p | ||
GROUP BY | ||
key | ||
with mergefinalize | ||
; | ||
|
||
$p1 = PROCESS $p1; | ||
--select FormatType(TypeOf($p1)); | ||
select * from $p1; | ||
|
||
$p2 = SELECT | ||
key,avg(a) as a | ||
FROM (select key, just(a) as a from $p) | ||
GROUP BY | ||
key | ||
with mergemanyfinalize | ||
; | ||
|
||
$p2 = PROCESS $p2; | ||
--select FormatType(TypeOf($p2)); | ||
select * from $p2; | ||
|
||
$p3 = | ||
SELECT | ||
key,avg(value) as a | ||
FROM $t | ||
GROUP BY | ||
key | ||
with finalize | ||
; | ||
|
||
$p3 = PROCESS $p3; | ||
--select FormatType(TypeOf($p)); | ||
select * from $p3; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
in Input input_decimal.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
USE plato; | ||
|
||
SELECT | ||
avg(cs_ext_list_price), avg(cs_ext_tax), | ||
avg(cs_ext_list_price) * decimal("1.1", 7, 2), | ||
decimal("1.1", 7, 2) * avg(cs_ext_tax), | ||
FROM Input; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters