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

Name support for dynamic columns

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.0.1
    • None
    • None

    Description

      Dynamic columns should be referred by names (now only numeric references supported).

      Numeric (current) format of dynamic columns string is:

      fixed part
      1 byte flags (now stores <offset size> - 1 in first 2 bits)
      2 bytes column counter
      fixed size column headers sorted by column number, each entry contains of:
      2 bytes column number
      1-4 bytes combined offset from beginning of the data segment + 3 bit type
      data of above columns size of data and length depend on type

      For columns with names proposed following format. I think in this format numeric references could be written as strings.

      fixed part
      1 byte flags (now stores <offset size> - 1 in first 2 bits, and 1 bit to set this new format)
      2 bytes column counter
      2 bytes size of stored names pool
      fixed size column headers sorted by names, each consists of
      1 byte length of the name
      2 bytes offset of name
      1-4 bytes combined offset from beginning of the data segment + 3 bit type
      names stored one after another
      data of above columns size of data and length depend on type

      there was other ideas which I think is not so good:

      1. store names just in header part (then it looses its array properties and binary search)
      2. store both headers numbers and names (I doubts that both way of references could be used simultaneously). (We have agreed this is not possible, because name↔number mapping must be the same for every record in the table, and there is no way we could efficiently maintain this mapping. For example, HBase does not provide any fast way to get a full list of column names).

      Limitations:

      • each name not more then 255 symbols
      • sum of all names length cant be more then 65535

      New format used if

      • at least one of dynamic column references has non integer type.
        or
      • dynamic column string on which operation performed has new format

      New low level interface functions:

      Parameters of creating/changing functions:

      DYNAMIC_COLUMN *str the dynamic column.
      uchar *column_keys array of uint or LEX_STRING keys depends on names
      DYNAMIC_COLUMN_VALUE *values array of values
      uint column_count number of above arrays
      my_bool names TRUE if names are character strings

      enum enum_dyncol_func_result
      dynamic_column_create_many_fmt(DYNAMIC_COLUMN *str,
                                     uint column_count,
                                     uchar *column_keys,
                                     DYNAMIC_COLUMN_VALUE *values,
                                     my_bool names);
      enum enum_dyncol_func_result
      dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str,
                                     uint add_column_count,
                                     void *column_keys,
                                     DYNAMIC_COLUMN_VALUE *values,
                                     my_bool string_keys);

      Check existence of column (not null) (2 functions, one is addition to old
      function, other is universal)

      enum enum_dyncol_func_result
      dynamic_column_exists_str(DYNAMIC_COLUMN *str, LEX_STRING *name);
      enum enum_dyncol_func_result
      dynamic_column_exists_fmt(DYNAMIC_COLUMN *str, void *key, my_bool string_keys);

      Get list of of columns (works for both formats):

      enum enum_dyncol_func_result
      dynamic_column_list_str(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_lexstr);

      Get column value (2 functions, one is addition to old
      function, other is universal)

      enum enum_dyncol_func_result
      dynamic_column_get_str(DYNAMIC_COLUMN *str, LEX_STRING *name,
                                 DYNAMIC_COLUMN_VALUE *store_it_here);
      enum enum_dyncol_func_result
      dynamic_column_get_fmt(DYNAMIC_COLUMN *str, void *key,
                                 DYNAMIC_COLUMN_VALUE *store_it_here,
                                 my_bool names)

      Check the string format:

      my_bool dynamic_column_has_names(DYNAMIC_COLUMN *str);

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              sanja Oleksandr Byelkin
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.