XiaoMi / soar

SQL Optimizer And Rewriter
Apache License 2.0
8.67k stars 1.32k forks source link

report type为json时,输出中缺少sql语句 #212

Closed bruceauyeung closed 5 years ago

bruceauyeung commented 5 years ago

输出的内容中至少得有sql啊,这可是主角啊.单条语句的分析缺了话还能勉强接受,批量的话,怎么对应的上?

  1. What did you expect to see?
    "IDX.002": {
      "Item": "IDX.002",
      "sql":"select * from table1 where 1=1",
      "Severity": "L2",
      "Summary": "为msp_message库的message_topic表添加索引",
      "Content": "为列cluster_id添加索引为列name添加索引",
      "Case": "ALTER TABLE `msp_message`.`message_topic` add index `idx_cluster_id` (`cluster_id`), add index `idx_name` (`name`) ;\n",
      "Position": 0
    },
    "RES.002": {
      "Item": "RES.002",
      "sql":"select * from table1 where 1=1",
      "Severity": "L4",
      "Summary": "未使用 ORDER BY 的 LIMIT 查询",
      "Content": "没有 ORDER BY 的 LIMIT 会导致非确定性的结果,这取决于查询执行计划。",
      "Case": "select col1,col2 from tbl where name=xx limit 10",
      "Position": 0
    }
  1. What did you see instead?
    
    "IDX.002": {
      "Item": "IDX.002",
      "Severity": "L2",
      "Summary": "为msp_message库的message_topic表添加索引",
      "Content": "为列cluster_id添加索引为列name添加索引",
      "Case": "ALTER TABLE `msp_message`.`message_topic` add index `idx_cluster_id` (`cluster_id`), add index `idx_name` (`name`) ;\n",
      "Position": 0
    },
    "RES.002": {
      "Item": "RES.002",
      "Severity": "L4",
      "Summary": "未使用 ORDER BY 的 LIMIT 查询",
      "Content": "没有 ORDER BY 的 LIMIT 会导致非确定性的结果,这取决于查询执行计划。",
      "Case": "select col1,col2 from tbl where name=xx limit 10",
      "Position": 0
    }


4. What version of are you using (`soar -version`)?
 `2019-01-21 16:54:09 +0800 0.11.0-16-gc12ae96`
martianzhang commented 5 years ago

新版本对 JSON 格式进行了修改,您使用的版本较低所以看不到 Sample

image

bruceauyeung commented 5 years ago

我clone了最新的代码进行编译,结果也是一样的。 是不是你这份代码没有提交的?我看数据格式差异非常大。 @martianzhang