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

Function test_sql_interview_Q2

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

Source from the content-addressed store, hash-verified

1042
1043
1044def test_sql_interview_Q2():
1045 EmployeeInfo = T(
1046 """
1047 EmpID|EmpFname|EmpLname|Department|Project|Address|DOB|Gender
1048 1|Sanjay|Mehra|HR|P1|Hyderabad(HYD)|01/12/1976|M
1049 2|Ananya|Mishra|Admin|P2|Delhi(DEL)|02/05/1968|F
1050 3|Rohan|Diwan|Account|P3|Mumbai(BOM)|01/01/1980|M
1051 4|Sonia|Kulkarni|HR|P1|Hyderabad(HYD)|02/05/1992|F
1052 5|Ankit|Kapoor|Admin|P2|Delhi(DEL)|03/07/1994|M
1053 """
1054 )
1055 sql_query = "SELECT COUNT(*) FROM EmployeeInfo WHERE Department = 'HR';"
1056 res_table = pw.sql(sql_query, EmployeeInfo=EmployeeInfo)
1057 expected_table = EmployeeInfo.filter(pw.this.Department == "HR").reduce(
1058 _col_0=pw.reducers.count()
1059 )
1060 assert_table_equality(
1061 res_table,
1062 expected_table,
1063 )
1064
1065
1066@pytest.mark.xfail(reason="KeyError: 'from'")

Callers

nothing calls this directly

Calls 4

TFunction · 0.90
countMethod · 0.80
reduceMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected