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

Function count_component1

evaluation/test-suite-sql-eval/evaluation.py:302–320  ·  view source on GitHub ↗
(sql)

Source from the content-addressed store, hash-verified

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

Callers 1

eval_hardnessMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected