(sql)
| 843 | |
| 844 | |
| 845 | def count_others(sql): |
| 846 | count = 0 |
| 847 | # number of aggregation |
| 848 | agg_count = count_agg(sql['select'][1]) |
| 849 | agg_count += count_agg(sql['where'][::2]) |
| 850 | agg_count += count_agg(sql['groupBy']) |
| 851 | if len(sql['orderBy']) > 0: |
| 852 | agg_count += count_agg([unit[1] for unit in sql['orderBy'][1] if unit[1]] + [unit[2] for unit in sql['orderBy'][1] if unit[2]]) |
| 853 | agg_count += count_agg(sql['having']) |
| 854 | if agg_count > 1: |
| 855 | count += 1 |
| 856 | |
| 857 | # number of select columns |
| 858 | if len(sql['select'][1]) > 1: |
| 859 | count += 1 |
| 860 | |
| 861 | # number of where conditions |
| 862 | if len(sql['where']) > 1: |
| 863 | count += 1 |
| 864 | |
| 865 | # number of group by clauses |
| 866 | if len(sql['groupBy']) > 1: |
| 867 | count += 1 |
| 868 | |
| 869 | return count |
| 870 | |
| 871 | |
| 872 | def eval_hardness(sql): |
no test coverage detected