[ https://issues.apache.org/jira/browse/CALCITE-4924?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
duan xiong updated CALCITE-4924: -------------------------------- Summary: The aggregate functions about Covariance return the wrong data type (was: The aggregate functions about Covariance returns a wrong data type) > The aggregate functions about Covariance return the wrong data type > ------------------------------------------------------------------- > > Key: CALCITE-4924 > URL: https://issues.apache.org/jira/browse/CALCITE-4924 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.28.0 > Reporter: duan xiong > Priority: Major > > The SQL: > {code:java} > SELECT regr_sxx(SAL, COMM) as "REGR_SXX(SAL, COMM)" from "scott".emp; {code} > This SQL top physical plan is: > {code:java} > EnumerableCalc(expr#0..2=[{inputs}], expr#3=[CAST($t0):DECIMAL(7, 2)], > expr#4=[0], expr#5=[=($t2, $t4)], expr#6=[null:INTEGER], expr#7=[*($t1, > $t1)], expr#8=[/($t7, $t2)], expr#9=[CASE($t5, $t6, $t8)], > expr#10=[CAST($t9):DECIMAL(7, 2)], expr#11=[-($t3, $t10)], > expr#12=[CAST($t11):DECIMAL(7, 2)], REGR_SXX(SAL, COMM)=[$t12]){code} > According to the physical plan, The data type of result should be DECIMAL(7, > 2). But the asserted result is: > {noformat} > +---------------------+ > |REGR_SXX(SAL, COMM) | > +---------------------+ > | 1090000.0000 | > +---------------------+ > (1 row){noformat} > Actually, this result value can't fit in DECIMAL(7, 2). > The Postgresql about this aggregation functions in > [agg-functions|https://www.yiibai.com/manual/postgresql/functions-aggregate.html]. > -- This message was sent by Atlassian Jira (v8.20.1#820001)