You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2024/03/12 23:22:00 UTC

[jira] [Created] (CALCITE-6324) Type inferred for result of STDDEV, VAR_SAMP, etc. is incorrect

Mihai Budiu created CALCITE-6324:
------------------------------------

             Summary: Type inferred for result of STDDEV, VAR_SAMP, etc. is incorrect
                 Key: CALCITE-6324
                 URL: https://issues.apache.org/jira/browse/CALCITE-6324
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.36.0
            Reporter: Mihai Budiu


These functions are all use the same type inference algorithm, essentially the algorithm used by AVG.

But if the values processed are decimal, STDDEV (and others) need much higher precision to represent the result. (I am not sure that the inference is right for integer types either, btw.)

This surfaced during the implementation of a fix for [CALCITE-6322]: if we use the type inferred for these functions, the result overflows and causes a runtime exception.





--
This message was sent by Atlassian Jira
(v8.20.10#820010)