Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-33703

Negative numbers and differnce of behaviour between sys.format_time() and FORMAT_PICO_TIME()

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 11.5
    • None
    • None
    • None
    • Ubuntu 22.04

    Description

      in format_pico_time it does convert it into the correct unit and in sys.format_time it does not and only displays -number ps.
      Is this wanted or is this considered a bug, is working with negatives it self is the correct behaviour or should it convert it to positive ?

      Input:

      select format_pico_time(-5000);
      select sys.format_time(-5000);
      select format_pico_time(-1000000);
      select sys.format_time(-1000000);
      

      Output:

      +-------------------------+
      | format_pico_time(-5000) |
      +-------------------------+
      | -5.00 ns                |
      +-------------------------+
      +------------------------+
      | sys.format_time(-5000) |
      +------------------------+
      | -5000 ps               |
      +------------------------+
      +----------------------------+
      | format_pico_time(-1000000) |
      +----------------------------+
      | -1.00 us                   |
      +----------------------------+
      +---------------------------+
      | sys.format_time(-1000000) |
      +---------------------------+
      | -1000000 ps               |
      +---------------------------+
      
      

      there's the same issue with sys.format_bytes() where it displays -number bytes whether the number is small or large.

      the behavior with negative numbers is not mentioned in neither https://mariadb.com/kb/en/format_pico_time/ nor https://mariadb.com/kb/en/format_time/ , if the current behavior is intended I think it should at least be added to documentation to make it clearer.

      knowing the correct behavior this would be an easy issue to solve.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Abdelfatah Abdelrahman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.