(sql)
| 326 | |
| 327 | |
| 328 | def count_others(sql): |
| 329 | count = 0 |
| 330 | # number of aggregation |
| 331 | agg_count = count_agg(sql['select'][1]) |
| 332 | agg_count += count_agg(sql['where'][::2]) |
| 333 | agg_count += count_agg(sql['groupBy']) |
| 334 | if len(sql['orderBy']) > 0: |
| 335 | agg_count += count_agg([unit[1] for unit in sql['orderBy'][1] if unit[1]] + |
| 336 | [unit[2] for unit in sql['orderBy'][1] if unit[2]]) |
| 337 | agg_count += count_agg(sql['having']) |
| 338 | if agg_count > 1: |
| 339 | count += 1 |
| 340 | |
| 341 | # number of select columns |
| 342 | if len(sql['select'][1]) > 1: |
| 343 | count += 1 |
| 344 | |
| 345 | # number of where conditions |
| 346 | if len(sql['where']) > 1: |
| 347 | count += 1 |
| 348 | |
| 349 | # number of group by clauses |
| 350 | if len(sql['groupBy']) > 1: |
| 351 | count += 1 |
| 352 | |
| 353 | return count |
| 354 | |
| 355 | |
| 356 | class Evaluator: |
no test coverage detected