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

Laurent Goujon commented on CALCITE-1442:
-----------------------------------------

Updated my pull request with a new test case in SqlValidatorTest:
{code:java}
    checkExpType(
        "CASE 1 WHEN 1 THEN INTERVAL '12 3:4:5.6' DAY TO SECOND(6) WHEN 2 THEN 
INTERVAL '12 3:4:5.6' DAY TO SECOND(9) END",
        "INTERVAL DAY TO SECOND(9)");
{code}

With the current code, returned type is {{INTERVAL DAY TO SECOND(6)}}.

> SqlIntervalQualifer#getFractionalSecondPrecisionPreservingDefault() returns 
> the wrong field
> -------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-1442
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1442
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Laurent Goujon
>            Assignee: Julian Hyde
>            Priority: Minor
>
> Unless I'm wrong, I believe 
> {{SqlIntervalQualifer#getFractionalSecondPrecisionPreservingDefault()}} 
> returns the wrong field:
> {code:java}
>   public int getFractionalSecondPrecision(RelDataTypeSystem typeSystem) {
>     if (fractionalSecondPrecision == RelDataType.PRECISION_NOT_SPECIFIED) {
>       return typeName().getDefaultScale();
>     } else {
>       return fractionalSecondPrecision;
>     }
>   }
>   public int getFractionalSecondPrecisionPreservingDefault() {
>     if (useDefaultFractionalSecondPrecision()) {
>       return RelDataType.PRECISION_NOT_SPECIFIED;
>     } else {
>       return startPrecision;
>     }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to