Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2989

The method ymdToJulian in DateTimeUtils returns wrong value

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: avatica
    • Labels:
      None

      Description

      If we uses avatica's DateTimeUtils the dates less than 2299161 will cause an error result in Flink table/sql , test code :

      testAllApis(
        "1500-04-30 12:00:00".cast(Types.SQL_TIMESTAMP),
        "'1500-04-30 12:00:00'.cast(SQL_TIMESTAMP)",
        "CAST('1500-04-30 12:00:00' AS TIMESTAMP)",
        "1500-04-30 12:00:00.0")
      

      result :

      Expected :1500-04-30 12:00:00.0
      Actual :1500-04-20 12:00:00.0
      

      another case is here : 

      https://issues.apache.org/jira/browse/FLINK-11935

      I find a key code snippet has been removed in CALCITE-1884 which caused this issue :

      if (j < 2299161) {
         j = day + (153 * m + 2) / 5 + 365 * y + y / 4 - 32083;
      }
      

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                yanghua vinoyang
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: