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

Function count_component1

hardness_eval.py:819–837  ·  view source on GitHub ↗
(sql)

Source from the content-addressed store, hash-verified

817
818
819def count_component1(sql):
820 count = 0
821 if len(sql['where']) > 0:
822 count += 1
823 if len(sql['groupBy']) > 0:
824 count += 1
825 if len(sql['orderBy']) > 0:
826 count += 1
827 if sql['limit'] is not None:
828 count += 1
829 if len(sql['from']['table_units']) > 0: # JOIN
830 count += len(sql['from']['table_units']) - 1
831
832 ao = sql['from']['conds'][1::2] + sql['where'][1::2] + sql['having'][1::2]
833 count += len([token for token in ao if token == 'or'])
834 cond_units = sql['from']['conds'][::2] + sql['where'][::2] + sql['having'][::2]
835 count += len([cond_unit for cond_unit in cond_units if cond_unit[1] == WHERE_OPS.index('like')])
836
837 return count
838
839
840def count_component2(sql):

Callers 1

eval_hardnessFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected