You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "xiong duan (Jira)" <ji...@apache.org> on 2025/04/09 02:26:00 UTC
[jira] [Commented] (CALCITE-6548) Result type inferred for COVAR_SAMP、COVAR_POP is incorrect
[ https://issues.apache.org/jira/browse/CALCITE-6548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17942062#comment-17942062 ]
xiong duan commented on CALCITE-6548:
-------------------------------------
The returned data from Oracle is different from that of other databases (such as Pg and Spark).
In Postgresql:
{code:java}
SELECT COVAR_POP(x, y) FROM (VALUES (1, 2)) AS t(x, y); // return 0{code}
In Oracle:
{code:java}
SELECT COVAR_POP(x, y) FROM (SELECT 1 x, 2 y) t; // return null{code}
> Result type inferred for COVAR_SAMP、COVAR_POP is incorrect
> ----------------------------------------------------------
>
> Key: CALCITE-6548
> URL: https://issues.apache.org/jira/browse/CALCITE-6548
> Project: Calcite
> Issue Type: Improvement
> Reporter: xiong duan
> Assignee: xiong duan
> Priority: Major
> Labels: pull-request-available
>
> COVAR_SAMP can return NULL. If the function is applied to an empty set, it returns null. E.g. see the Oracle documentation: [https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/VAR_SAMP.html|https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/COVAR_SAMP.html] .
> COVAR_POP see the Oracle documentation: [https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/COVAR_POP.html|https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/COVAR_POP.html].
--
This message was sent by Atlassian Jira
(v8.20.10#820010)