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

Distance functions on vectors of different length return NULL without warnings

    XMLWordPrintable

Details

    Description

      When two vectors of different lengths are passed as arguments to distance functions, the functions return NULL without an error or a warning

      bb-11.6-MDEV-32887-vector 27ae9cbb91489e93fe30b02360a843f974e5e1fc

      MariaDB [test]> select vec_distance_euclidean(0x00000000000000000,0x00000000);
      +--------------------------------------------------------+
      | vec_distance_euclidean(0x00000000000000000,0x00000000) |
      +--------------------------------------------------------+
      |                                                   NULL |
      +--------------------------------------------------------+
      1 row in set (0.001 sec)
      

      If it's intentional, I think it needs to find a notable place in the documentation: it is a mistake easy to make (not with the constant values as above of course, but with columns, variables, parameters etc), and given that the main purpose of the functions is to be used in ORDER BY – that is, not to return the result set explicitly, easy to miss, as the queries will still work, they'll be just returning random-ish results instead of best matches.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.