[ 
https://issues.apache.org/jira/browse/CALCITE-6541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17900499#comment-17900499
 ] 

Mihai Budiu commented on CALCITE-6541:
--------------------------------------

Actually there is a comment in SqlStdOperatorTable which suggests that this is 
by design:
{code:java}
  public static final SqlFunction MOD =
      // Return type is same as divisor (2nd operand)
      // SQL2003 Part2 Section 6.27, Syntax Rules 9
      SqlBasicFunction.create(SqlKind.MOD,
          ReturnTypes.NULLABLE_MOD,
          OperandTypes.EXACT_NUMERIC_EXACT_NUMERIC)
          .withFunctionType(SqlFunctionCategory.NUMERIC);
{code}

So it looks like mod is a different operator in Postgres.

> Type inference for MOD operator is incorrect
> --------------------------------------------
>
>                 Key: CALCITE-6541
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6541
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.37.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>
> One would expect MOD(BIGINT, INT) to produce a BIGINT result, but the type is 
> inferred as INT.



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

Reply via email to