(args *common.QuerierParams)
| 182 | } |
| 183 | |
| 184 | func (e *CHEngine) ExecuteQuery(args *common.QuerierParams) (*common.Result, map[string]interface{}, error) { |
| 185 | // 解析show开头的sql |
| 186 | // show metrics/tags from <table_name> 例:show metrics/tags from l4_flow_log |
| 187 | var err error |
| 188 | sql := args.Sql |
| 189 | e.Context = args.Context |
| 190 | e.NoPreWhere = args.NoPreWhere |
| 191 | e.Language = args.Language |
| 192 | e.ORGID = common.DEFAULT_ORG_ID |
| 193 | if args.ORGID != "" { |
| 194 | e.ORGID = args.ORGID |
| 195 | } |
| 196 | query_uuid := args.QueryUUID // FIXME: should be queryUUID |
| 197 | debug_info := &client.DebugInfo{} |
| 198 | // replace custom_biz_filter |
| 199 | fromMatch := fromRegexp.FindStringSubmatch(sql) |
| 200 | if len(fromMatch) > 1 { |
| 201 | table := fromMatch[1] |
| 202 | if table != chCommon.TABLE_NAME_ALERT_EVENT && table != chCommon.TABLE_NAME_ALERT_RECORD { |
| 203 | sql, err = ReplaceCustomBizServiceFilter(sql, e.ORGID) |
| 204 | if err != nil { |
| 205 | return nil, nil, err |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | // Parse withSql |
| 210 | withResult, withDebug, err := e.QueryWithSql(sql, args) |
| 211 | if err != nil { |
| 212 | if withDebug != nil { |
| 213 | debug_info.Debug = append(debug_info.Debug, *withDebug) |
| 214 | } |
| 215 | return nil, debug_info.Get(), err |
| 216 | } |
| 217 | if withResult != nil { |
| 218 | debug_info.Debug = append(debug_info.Debug, *withDebug) |
| 219 | return withResult, debug_info.Get(), err |
| 220 | } |
| 221 | // Parse slimitSql |
| 222 | slimitResult, slimitDebug, err := e.QuerySlimitSql(sql, args) |
| 223 | if err != nil { |
| 224 | if slimitDebug != nil { |
| 225 | debug_info.Debug = append(debug_info.Debug, *slimitDebug) |
| 226 | } |
| 227 | return nil, debug_info.Get(), err |
| 228 | } |
| 229 | if slimitResult != nil { |
| 230 | debug_info.Debug = append(debug_info.Debug, *slimitDebug) |
| 231 | return slimitResult, debug_info.Get(), err |
| 232 | } |
| 233 | // Parse showSql |
| 234 | debug := &client.Debug{ |
| 235 | IP: config.Cfg.Clickhouse.Host, |
| 236 | QueryUUID: query_uuid, |
| 237 | } |
| 238 | // For testing purposes, ParseShowSql requires the addition of the debug parameter |
| 239 | result, sqlList, isShow, err := e.ParseShowSql(sql, args, debug_info) |
| 240 | if isShow { |
| 241 | if err != nil { |
no test coverage detected