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

Function count_component1

single_eval.py:303–321  ·  view source on GitHub ↗
(sql)

Source from the content-addressed store, hash-verified

301
302
303def count_component1(sql):
304 count = 0
305 if len(sql['where']) > 0:
306 count += 1
307 if len(sql['groupBy']) > 0:
308 count += 1
309 if len(sql['orderBy']) > 0:
310 count += 1
311 if sql['limit'] is not None:
312 count += 1
313 if len(sql['from']['table_units']) > 0: # JOIN
314 count += len(sql['from']['table_units']) - 1
315
316 ao = sql['from']['conds'][1::2] + sql['where'][1::2] + sql['having'][1::2]
317 count += len([token for token in ao if token == 'or'])
318 cond_units = sql['from']['conds'][::2] + sql['where'][::2] + sql['having'][::2]
319 count += len([cond_unit for cond_unit in cond_units if cond_unit[1] == WHERE_OPS.index('like')])
320
321 return count
322
323
324def count_component2(sql):

Callers 1

eval_hardnessMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected