Skip to content
  • Narayanan Iyer's avatar
    [#616] Revert MAYBE_CANONICAL related changes in 58d38301 · 732b05b3
    Narayanan Iyer authored
    * This commit reverts the `MAYBE_CANONICAL` keyword related changes in 58d38301
    
      The reason for the revert is that `MAYBE_CANONICAL` keyword is being nixed. See
      https://gitlab.com/YottaDB/DBMS/YDBOcto/-/issues/616#note_1612644321 for more details.
    
      Most of the changes in this commit to files in `doc/`, `src/` and `tests/` files are
      related to this revert.
    
    * There are a few changes which are not related to the revert. They are described below.
    
    * src/octo.h :
      - A query which uses inequality operators in the WHERE clause could now generate different M code
        than before when `VARCHAR` columns are involved due to the lack of the #616 optimization.
        Therefore `FMT_PLAN_DEFINITION` was bumped.
      - Since the `OPTIONAL_MAYBE_CANONICAL` keyword was removed from `OptionalKeyword` in `octo_types.h`
        it is likely that binary definitions would change as keywords are used in various structures so
        the `FMT_BINARY_DEFINITION` macro was changed just to be safe.
    
    * src/optimization_transforms/logical_plan.h : 2 possible values of `fixed_to_value_type` field were
      added (they had been missed out in 58d38301).
    
    * src/optimization_transforms/lp_optimize_order_by.c : When `key->fixed_to_value_type` was
      `LP_BOOLEAN_IS`, we would disable the ORDER BY optimization unnecessarily thinking it corresponds
      to a range of values but this was a case of `IS NULL` which corresponds to one fixed value only.
      Therefore it is now enabled by adding an `ok_to_optimize` variable that does the proper tracking.
    
    * src/optimization_transforms/lp_optimize_where_multi_equals_ands.c : A comment was added that
      when YottaDB/Util/YDBAIM#73 is fixed, the disabled #616 key-fixing optimization for VARCHAR/STRING
      typed columns can be re-enabled.
    
    * tests/outref/TEO03.ref : The last query in `tests/outref/TEO03.sql` (that used the `northwind` data set)
      emitted different M code because it was using a WHERE clause with a STRING typed column with an
      inequality operator. This is expected because the #616 key-fixing optimization was disabled for STRING
      typed columns as part of this commit and so the reference file was updated to reflect the new behavior.
      This will change once again when the #616 key-fixing optimization is re-enabled for STRING columns in
      a later commit.
    
    * tests/outref/TWO19.ref : There were various queries using STRING typed columns with `<` operator etc.
      in the WHERE clause. The emitted M code changed due to the #616 key fixing optimization being disabled
      as part of this commit. The reference file is updated to reflect the new behavior. This will change once
      again when the #616 key-fixing optimization is re-enabled for STRING columns in a later commit.
    
    * tools/ci/build.sh : Since we now have a small range of commits (58d38301..538cb03a) that understand
      and use the `MAYBE_CANONICAL` keyword but the master branch no longer does, we should not allow these
      commits as the older commit in the `test-auto-upgrade` job. Or else the newer build of octo would issue
      a syntax error when it encounters the `MAYBE_CANONICAL` keyword in the `CREATE TABLE` command as part
      of the auto upgrade. Therefore, this script now has logic to skip the auto upgrade job in case the
      randomly picked commit falls in this small range of commits.
    732b05b3