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

Vector functions re-use JSON warnings

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • N/A
    • N/A
    • Vector search
    • None

    Description

      From the severity perspective, the issue is of course trivial, but there is an "embarrassment factor" involved, so I'm filing it with high priority, to be fixed before the release. Feel free to demote.

      bb-11.6-MDEV-32887-vector eff6bc39fcb6e1f691fa08b153d9ea44b9f77b54

      MariaDB [test]> select VEC_FromText('x');
      +-------------------+
      | VEC_FromText('x') |
      +-------------------+
      | NULL              |
      +-------------------+
      1 row in set, 1 warning (0.001 sec)
       
      MariaDB [test]> show warnings;
      +---------+------+----------------------------------------------------------------------------------+
      | Level   | Code | Message                                                                          |
      +---------+------+----------------------------------------------------------------------------------+
      | Warning | 4038 | Syntax error in JSON text in argument 1 to function 'VEC_FromText' at position 1 |
      +---------+------+----------------------------------------------------------------------------------+
      1 row in set (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            serg Sergei Golubchik added a comment - - edited

            We use "JSON array syntax" for vectors, so this error is not inappropriate here.

            serg Sergei Golubchik added a comment - - edited We use "JSON array syntax" for vectors, so this error is not inappropriate here.

            I see. Indeed, it makes more sense then, although it's confusing. This one (same revision) which apparently passes JSON validation and goes further is much clearer:

            MariaDB [test]> select VEC_FromText('{}');
            +--------------------+
            | VEC_FromText('{}') |
            +--------------------+
            | NULL               |
            +--------------------+
            1 row in set, 1 warning (0.001 sec)
             
            MariaDB [test]> show warnings;
            +---------+------+-------------------------------------------------------------------------------------+
            | Level   | Code | Message                                                                             |
            +---------+------+-------------------------------------------------------------------------------------+
            | Warning | 4202 | Invalid vector format at offset: 1 for '{}'. Must be a valid JSON array of numbers. |
            +---------+------+-------------------------------------------------------------------------------------+
            1 row in set (0.000 sec)
            

            elenst Elena Stepanova added a comment - I see. Indeed, it makes more sense then, although it's confusing. This one (same revision) which apparently passes JSON validation and goes further is much clearer: MariaDB [test]> select VEC_FromText( '{}' ); + --------------------+ | VEC_FromText( '{}' ) | + --------------------+ | NULL | + --------------------+ 1 row in set , 1 warning (0.001 sec)   MariaDB [test]> show warnings; + ---------+------+-------------------------------------------------------------------------------------+ | Level | Code | Message | + ---------+------+-------------------------------------------------------------------------------------+ | Warning | 4202 | Invalid vector format at offset: 1 for '{}' . Must be a valid JSON array of numbers. | + ---------+------+-------------------------------------------------------------------------------------+ 1 row in set (0.000 sec)

            Correct. It must be 1) a valid JSON and 2) a valid JSON array.

            If it's completely invalid JSON, the error points exactly at the position where JSON syntax error happened.
            If it's a valid JSON, but not an array of number, there is no position to point to, so the error simply says "must be a JSON array"

            serg Sergei Golubchik added a comment - Correct. It must be 1) a valid JSON and 2) a valid JSON array. If it's completely invalid JSON, the error points exactly at the position where JSON syntax error happened. If it's a valid JSON, but not an array of number, there is no position to point to, so the error simply says "must be a JSON array"

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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