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

Get rid of Item::null_value

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      In order to make Items reentrant (see MDEV-6897) we need to get rid of the boolean member Item::null_value.

      To remove this member, we'll need to modify the following methods in Item to return the actual value and the SQL NULL flag at the same time:

      virtual bool val_bool();
      virtual double val_real();
      virtual longlong val_int();
      

      Note, the other methods val_str(), val_decimal(), get_date(), get_time() do not necessarily need to be modified, because they already return SQL NULL as their return value:

      • val_str() returns NULL to mean SQL NULL
      • val_decimal() returns NULL to mean SQL NULL
      • get_date() returns true to mean SQL NULL
      • get_time() returns true to mean SQL NULL

      Possible options

      Add a pointer to the SQL NULL flag:

      virtual bool val_bool_null(bool *null_value_arg);
      virtual longlong val_int_null(bool *null_value_arg);
      virtual double val_real_null(bool *null_value_arg);
      

      Return SQL NULL, pass the value target as a pointer:

      virtual bool get_bool(bool *to);
      virtual bool get_longlong(longlong *to);
      virtual bool get_double(double *to);
      

      Return a structure consisting of the value and the SQL NULL flag

      virtual Bool_null to_bool_null();
      virtual Longlong_null to_longlong_null();
      virtual Double_null to_double_null();
      

      where the structures are about the following:

      class Bool_null { bool value; bool is_null };
      class Longlong_null { longlong value; bool is_null };
      class Double_null { double value; bool is_null };
      

      Mixed

      A mixed API could be also considered depending on which exact method performs better for a certain data type. For example:

      virtual Bool_null to_bool_null();
      virtual longlong val_int_null(bool *null_value_arg);
      virtual bool get_double(double *to);
      

      But this probably won't be convenient.

      Plan

      Under terms of this task we'll:

      • Implement a bechmark program to test the performance of all proposed new API versions
      • Find the way which performs better for every data type
      • Discuss the winner methods
      • Decide the new API
      • Implement the decided API

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              bar Alexander Barkov
              Votes:
              0 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.