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

Caican Cai edited comment on CALCITE-6536 at 8/19/24 4:15 PM:
--------------------------------------------------------------

After testing, I found that in bigquery

{code:java}
date_add(date '0001-01-01', interval '-367' day)

Adding -367 DAY to date 0001-01-01 causes overflow
{code}

And BigQuery does not allow 0000-01-01 to be returned as a parameter or result.

At present, it seems that the date function of calcite is correct in checking 
the parameter type, but there is no restriction on the result. Is this another 
problem?


was (Author: JIRAUSER302115):
After testing, I found that in bigquery

{code:java}
date_add(date '0001-01-01', interval '-367' day)

Adding -367 DAY to date 0001-01-01 causes overflow
{code}

And BigQuery does not allow 0000-01-01 to be returned as a parameter or result.

At present, calcite's verification of parameter types is correct, but there is 
no restriction on the results. Is this another problem?

> Dates before BC cannot be used as arguments to date functions
> -------------------------------------------------------------
>
>                 Key: CALCITE-6536
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6536
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.37.0
>            Reporter: Caican Cai
>            Priority: Major
>             Fix For: 1.38.0
>
>
> {code:java}
> f.checkScalar("date_add(date '0001-01-01', interval '-367' day)",
>         "000/-12-31",
>         "DATE NOT NULL");
> {code}
> This test is correct, but when I use 000/-12-31 as the parameter to test it 
> fails
> {code:java}
>     f.checkScalar("date_add(date '000/-12-31', interval 5 day)",
>         "000-12-31",
>         "DATE NOT NULL");
> org.apache.calcite.runtime.CalciteContextException: From line 1, column 18 to 
> line 1, column 34: Illegal DATE literal '000/-12-31': not in format 
> 'yyyy-MM-dd'
> {code}



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

Reply via email to