MCPcopy Create free account
hub / github.com/FlyingFeather/DEA-SQL / count_others

Function count_others

hardness_eval.py:845–869  ·  view source on GitHub ↗
(sql)

Source from the content-addressed store, hash-verified

843
844
845def 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
872def eval_hardness(sql):

Callers 1

eval_hardnessFunction · 0.70

Calls 1

count_aggFunction · 0.70

Tested by

no test coverage detected