Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-19162

Sql. Trim all less than millisecond information from timestamp.

    XMLWordPrintableJSON

Details

    Description

      Trim useful timestamp part:

      CREATE TABLE timestamps(id INTEGER PRIMARY KEY, i TIMESTAMP(9));
      INSERT INTO timestamps VALUES (101, TIMESTAMP '2023-03-29 08:22:33.005007');
      SELECT i from timestamps; <--- expect inserted, obtain trimmed : 2023-03-29 08:22:33.005 
      

      The root cause :
      RelJson#toJson() -> getValue3 -> getValue2 ->
      RexLiteral#getValueAs ->
      case TIMESTAMP:
      if (clazz == Long.class)

      { return clazz.cast(((TimestampString) value).getMillisSinceEpoch()); <-- here info is loosed. }

      Also CURRENT_TIMESTAMP return only 3 digits after last dot, don`t take into account TIMESTAMP(precision)

      The same for default value :
      testInsertDefaultValue ->
      DdlSqlToCommandConverter#fromLiteral
      case TIMESTAMP:

      Attachments

        Issue Links

          Activity

            People

              mzhuravkov Maksim Zhuravkov
              zstan Evgeny Stanilovsky
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m