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

Function count_others

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

Source from the content-addressed store, hash-verified

326
327
328def count_others(sql):
329 count = 0
330 # number of aggregation
331 agg_count = count_agg(sql['select'][1])
332 agg_count += count_agg(sql['where'][::2])
333 agg_count += count_agg(sql['groupBy'])
334 if len(sql['orderBy']) > 0:
335 agg_count += count_agg([unit[1] for unit in sql['orderBy'][1] if unit[1]] +
336 [unit[2] for unit in sql['orderBy'][1] if unit[2]])
337 agg_count += count_agg(sql['having'])
338 if agg_count > 1:
339 count += 1
340
341 # number of select columns
342 if len(sql['select'][1]) > 1:
343 count += 1
344
345 # number of where conditions
346 if len(sql['where']) > 1:
347 count += 1
348
349 # number of group by clauses
350 if len(sql['groupBy']) > 1:
351 count += 1
352
353 return count
354
355
356class Evaluator:

Callers 1

eval_hardnessMethod · 0.70

Calls 1

count_aggFunction · 0.70

Tested by

no test coverage detected