[ https://issues.apache.org/jira/browse/CALCITE-3435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16962789#comment-16962789 ]
Danny Chen edited comment on CALCITE-3435 at 10/30/19 7:50 AM: --------------------------------------------------------------- Here is what i found in the standard SQL 2011 6.28 <numeric value function> The "mod" syntax: {code:sql} <modulus expression> ::= MOD <left paren> <numeric value expression dividend> <comma> <numeric value expression divisor> <right paren> {code} Here is the type inference rules: bq. If <modulus expression> is specified, then the declared type of each <numeric value expression> shall be exact numeric with scale 0 (zero). The declared type of the result is the declared type of the immediately contained <numeric value expression divisor>. was (Author: danny0405): Here is what i found in the standard SQL 2011 6.28 <numeric value function> The "mod" syntax: {code:sql} <modulus expression> ::= MOD <left paren> <numeric value expression dividend> <comma> <numeric value expression divisor> <right paren> {code} Here is the type inference rules: bq. If <modulus expression> is specified, then the declared type of each <numeric value expression> shall be bq. exact numeric with scale 0 (zero). The declared type of the result is the declared type of the immediately bq. contained <numeric value expression divisor>. > floor(mod(33.5,7)) wrongly returns 5.5 > -------------------------------------- > > Key: CALCITE-3435 > URL: https://issues.apache.org/jira/browse/CALCITE-3435 > Project: Calcite > Issue Type: Bug > Affects Versions: 1.16.0, 1.21.0 > Reporter: jiezouSH > Assignee: Feng Zhu > Priority: Minor > > mod's return type is > chain(DECIMAL_MOD_NULLABLE, ARG1_NULLABLE), > but mod(33.5,7)'s result is 5.5, not in line with ARG1_NULLABLE. > This causes floor(mod(33.5,7)) wrongly returns 5.5 -- This message was sent by Atlassian Jira (v8.3.4#803005)