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

Function count_others

single_eval.py:329–354  ·  view source on GitHub ↗
(sql)

Source from the content-addressed store, hash-verified

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

Callers 1

eval_hardnessMethod · 0.70

Calls 1

count_aggFunction · 0.70

Tested by

no test coverage detected