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

Optimizer_trace has invalid JSON near rows_estimation

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • N/A
    • N/A
    • Optimizer
    • None

    Description

      I thought that improvements to JSON writer would make this impossible, but
      somehow they didn't?

      create table ten(a int);
      insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
      set optimizer_trace=1;
      select * from ten where a<3 ;
      

      produces:

              "steps": [
                {
                   ...
                },
                ...
                {
                  "ref_optimizer_key_uses": []
                },
                "rows_estimation": [
                  {
                    "selectivity_for_indexes": [],
                    "selectivity_for_columns": []
                  },
                  {
                    "table": "ten",
                    "table_scan": {
                      "rows": 10,
                      "cost": 1
                    }
                  }
                ],
      

      Note that "rows_estimation" is a named element, but it is in the "steps" array.

      Attachments

        Issue Links

          Activity

            execution_plan_for_potential_materialization has the same problem.

            psergei Sergei Petrunia added a comment - execution_plan_for_potential_materialization has the same problem.
            varun Varun Gupta (Inactive) added a comment - - edited

            I added a small patch to see the above irregularity

            --- a/sql/sql_select.cc
            +++ b/sql/sql_select.cc
            @@ -61,6 +61,7 @@
             #include <my_bit.h>
             #include <hash.h>
             #include <ft_global.h>
            +#include "my_json_writer.h"
             
             /*
               A key part number that means we're using a fulltext scan.
            @@ -1214,6 +1215,14 @@ JOIN::optimize_inner()
               set_allowed_join_cache_types();
               need_distinct= TRUE;
            +  {
            +    Json_writer wri;
            +    wri.start_array();
            +    wri.add_member("varun").start_object();
            +    wri.end_object();
            +    wri.end_array();
            +  }
            +
            

            And there is no assert failure , we are trying to add a key-value pair to the array which is incorrect accoring to JSON standards

            varun Varun Gupta (Inactive) added a comment - - edited I added a small patch to see the above irregularity --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -61,6 +61,7 @@ #include <my_bit.h> #include <hash.h> #include <ft_global.h> +#include "my_json_writer.h" /* A key part number that means we're using a fulltext scan. @@ -1214,6 +1215,14 @@ JOIN::optimize_inner() set_allowed_join_cache_types(); need_distinct= TRUE; + { + Json_writer wri; + wri.start_array(); + wri.add_member("varun").start_object(); + wri.end_object(); + wri.end_array(); + } + And there is no assert failure , we are trying to add a key-value pair to the array which is incorrect accoring to JSON standards

            Fixed as a part of MDEV-6111

            varun Varun Gupta (Inactive) added a comment - Fixed as a part of MDEV-6111

            People

              varun Varun Gupta (Inactive)
              psergei Sergei Petrunia
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.