MCPcopy
hub / github.com/pathwaycom/pathway / test_sql_interview_Q17_bis

Function test_sql_interview_Q17_bis

python/pathway/tests/test_sql.py:1434–1453  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1432
1433
1434def test_sql_interview_Q17_bis():
1435 EmployeeInfo = T(
1436 """
1437 EmpID|EmpFname|EmpLname|Department|Project|Address|DOB|Gender
1438 1|Sanjay|Mehra|HR|P1|Hyderabad(HYD)|01/12/1976|M
1439 2|Ananya|Mishra|Admin|P2|Delhi(DEL)|02/05/1968|F
1440 3|Rohan|Diwan|Account|P3|Mumbai(BOM)|01/01/1980|M
1441 4|Sonia|Kulkarni|HR|P1|Hyderabad(HYD)|02/05/1992|F
1442 5|Ankit|Kapoor|Admin|P2|Delhi(DEL)|03/07/1994|M
1443 """
1444 )
1445 sql_query = """
1446 SELECT Department, count(EmpID) AS EmpDeptCount
1447 FROM EmployeeInfo GROUP BY Department;
1448 """
1449 res_table = pw.sql(sql_query, EmployeeInfo=EmployeeInfo)
1450 expected_table = EmployeeInfo.groupby(pw.this.Department).reduce(
1451 pw.this.Department, EmpDeptCount=pw.reducers.count()
1452 )
1453 assert_table_equality(res_table, expected_table)
1454
1455
1456@pytest.mark.xfail(reason="NotImplementedError: MOD(rowno, 2) not supported.")

Callers

nothing calls this directly

Calls 4

TFunction · 0.90
countMethod · 0.80
reduceMethod · 0.45
groupbyMethod · 0.45

Tested by

no test coverage detected