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

clang x86_64 test failure - main.select - converting strings of numbers to compare against large bigint - loss of precision

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.2
    • 10.2
    • Data types
    • clang 3.9, 4.0, 5.0

    Description

      As discovered on travis, clang test (simplified as below fail).

      Simplified test

      create table  t1 (  A_Id bigint(20) NOT NULL default '0',  A_UpdateBy char(10) NOT NULL default '',  A_UpdateDate bigint(20) NOT NULL default '0',  A_UpdateSerial int(11) NOT NULL default '0',  other_types bigint(20) NOT NULL default '0',  wss_type bigint(20) NOT NULL default '0');
      INSERT INTO t1 VALUES (102935998719055004,'brade',1029359987,2,102935229116544068,102935229216544093);
      select wss_type from t1 where wss_type ='102935229216544093';
      

      This returns no results.

      As discovered with cvicentiu, the error manifests in stored_field_cmp_to_item.

      item_cmp_type returns a common factor of REAL between string and INT types and therefore adopts a double based equality test at the end of the stored_field_cmp_to_item function.

      Unfortunately the results for the conversion from the ulonglong in item->val_real() and field->val_real() differ by ~80 resulting in no equally and the SQL statement returning the wrong result.

      Options include:
      a) pushing an error when users quote numbers in queries - probably too common
      b) fix this such that where this string is meticulously parsed in my_strntoull10rnd_8bit, b1) the ability to convert this to an integer is determined. Special cases? exponents detected (these are tested that it still falls < CUTOFF so no action taken b2) large -ve exponents are rounded to 0. b3) Decimals are rounded (handle to DECIMAL type).
      c) fudge the test case until it pops up again

      Attachments

        Activity

          People

            cvicentiu Vicențiu Ciorbaru
            danblack Daniel Black
            Votes:
            1 Vote for this issue
            Watchers:
            4 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.