-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ir):
ibis.parse_sql()
removes where clause
- Loading branch information
Showing
16 changed files
with
363 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...xpr/tests/snapshots/test_sql/test_parse_sql_aggregation_with_multiple_joins/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import ibis | ||
|
||
|
||
call = ibis.table( | ||
name="call", | ||
schema={ | ||
"start_time": "timestamp", | ||
"end_time": "timestamp", | ||
"employee_id": "int64", | ||
"call_outcome_id": "int64", | ||
"call_attempts": "int64", | ||
}, | ||
) | ||
call_outcome = ibis.table( | ||
name="call_outcome", schema={"outcome_text": "string", "id": "int64"} | ||
) | ||
employee = ibis.table( | ||
name="employee", | ||
schema={"first_name": "string", "last_name": "string", "id": "int64"}, | ||
) | ||
innerjoin = employee.inner_join(call, employee.id == call.employee_id) | ||
|
||
result = ( | ||
innerjoin.inner_join(call_outcome, call.call_outcome_id == call_outcome.id) | ||
.select( | ||
[ | ||
innerjoin.first_name, | ||
innerjoin.last_name, | ||
innerjoin.id, | ||
innerjoin.start_time, | ||
innerjoin.end_time, | ||
innerjoin.employee_id, | ||
innerjoin.call_outcome_id, | ||
innerjoin.call_attempts, | ||
call_outcome.outcome_text, | ||
call_outcome.id.name("id_right"), | ||
] | ||
) | ||
.group_by(call.employee_id) | ||
.aggregate(call.call_attempts.mean().name("avg_attempts")) | ||
) |
17 changes: 17 additions & 0 deletions
17
ibis/expr/tests/snapshots/test_sql/test_parse_sql_basic_aggregation/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import ibis | ||
|
||
|
||
call = ibis.table( | ||
name="call", | ||
schema={ | ||
"start_time": "timestamp", | ||
"end_time": "timestamp", | ||
"employee_id": "int64", | ||
"call_outcome_id": "int64", | ||
"call_attempts": "int64", | ||
}, | ||
) | ||
|
||
result = call.group_by(call.employee_id).aggregate( | ||
call.call_attempts.sum().name("attempts") | ||
) |
22 changes: 22 additions & 0 deletions
22
ibis/expr/tests/snapshots/test_sql/test_parse_sql_basic_aggregation_with_join/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import ibis | ||
|
||
|
||
employee = ibis.table( | ||
name="employee", | ||
schema={"first_name": "string", "last_name": "string", "id": "int64"}, | ||
) | ||
call = ibis.table( | ||
name="call", | ||
schema={ | ||
"start_time": "timestamp", | ||
"end_time": "timestamp", | ||
"employee_id": "int64", | ||
"call_outcome_id": "int64", | ||
"call_attempts": "int64", | ||
}, | ||
) | ||
leftjoin = employee.left_join(call, employee.id == call.employee_id) | ||
|
||
result = leftjoin.group_by(leftjoin.id).aggregate( | ||
call.call_attempts.sum().name("attempts") | ||
) |
34 changes: 34 additions & 0 deletions
34
ibis/expr/tests/snapshots/test_sql/test_parse_sql_basic_join/inner/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import ibis | ||
|
||
|
||
call = ibis.table( | ||
name="call", | ||
schema={ | ||
"start_time": "timestamp", | ||
"end_time": "timestamp", | ||
"employee_id": "int64", | ||
"call_outcome_id": "int64", | ||
"call_attempts": "int64", | ||
}, | ||
) | ||
employee = ibis.table( | ||
name="employee", | ||
schema={"first_name": "string", "last_name": "string", "id": "int64"}, | ||
) | ||
proj = employee.inner_join(call, employee.id == call.employee_id).filter( | ||
employee.id < 5 | ||
) | ||
|
||
result = proj.select( | ||
[ | ||
proj.first_name, | ||
proj.last_name, | ||
proj.id, | ||
call.start_time, | ||
call.end_time, | ||
call.employee_id, | ||
call.call_outcome_id, | ||
call.call_attempts, | ||
proj.first_name.name("first"), | ||
] | ||
).order_by(proj.id.desc()) |
32 changes: 32 additions & 0 deletions
32
ibis/expr/tests/snapshots/test_sql/test_parse_sql_basic_join/left/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import ibis | ||
|
||
|
||
call = ibis.table( | ||
name="call", | ||
schema={ | ||
"start_time": "timestamp", | ||
"end_time": "timestamp", | ||
"employee_id": "int64", | ||
"call_outcome_id": "int64", | ||
"call_attempts": "int64", | ||
}, | ||
) | ||
employee = ibis.table( | ||
name="employee", | ||
schema={"first_name": "string", "last_name": "string", "id": "int64"}, | ||
) | ||
proj = employee.left_join(call, employee.id == call.employee_id).filter(employee.id < 5) | ||
|
||
result = proj.select( | ||
[ | ||
proj.first_name, | ||
proj.last_name, | ||
proj.id, | ||
call.start_time, | ||
call.end_time, | ||
call.employee_id, | ||
call.call_outcome_id, | ||
call.call_attempts, | ||
proj.first_name.name("first"), | ||
] | ||
).order_by(proj.id.desc()) |
34 changes: 34 additions & 0 deletions
34
ibis/expr/tests/snapshots/test_sql/test_parse_sql_basic_join/right/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import ibis | ||
|
||
|
||
call = ibis.table( | ||
name="call", | ||
schema={ | ||
"start_time": "timestamp", | ||
"end_time": "timestamp", | ||
"employee_id": "int64", | ||
"call_outcome_id": "int64", | ||
"call_attempts": "int64", | ||
}, | ||
) | ||
employee = ibis.table( | ||
name="employee", | ||
schema={"first_name": "string", "last_name": "string", "id": "int64"}, | ||
) | ||
proj = employee.right_join(call, employee.id == call.employee_id).filter( | ||
employee.id < 5 | ||
) | ||
|
||
result = proj.select( | ||
[ | ||
proj.first_name, | ||
proj.last_name, | ||
proj.id, | ||
call.start_time, | ||
call.end_time, | ||
call.employee_id, | ||
call.call_outcome_id, | ||
call.call_attempts, | ||
proj.first_name.name("first"), | ||
] | ||
).order_by(proj.id.desc()) |
12 changes: 12 additions & 0 deletions
12
ibis/expr/tests/snapshots/test_sql/test_parse_sql_basic_projection/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import ibis | ||
|
||
|
||
employee = ibis.table( | ||
name="employee", | ||
schema={"first_name": "string", "last_name": "string", "id": "int64"}, | ||
) | ||
proj = employee.filter(employee.id < 5) | ||
|
||
result = proj.select( | ||
[proj.first_name, proj.last_name, proj.id, proj.first_name.name("first")] | ||
).order_by(proj.id.desc()) |
32 changes: 32 additions & 0 deletions
32
ibis/expr/tests/snapshots/test_sql/test_parse_sql_join_with_filter/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import ibis | ||
|
||
|
||
call = ibis.table( | ||
name="call", | ||
schema={ | ||
"start_time": "timestamp", | ||
"end_time": "timestamp", | ||
"employee_id": "int64", | ||
"call_outcome_id": "int64", | ||
"call_attempts": "int64", | ||
}, | ||
) | ||
employee = ibis.table( | ||
name="employee", | ||
schema={"first_name": "string", "last_name": "string", "id": "int64"}, | ||
) | ||
proj = employee.left_join(call, employee.id == call.employee_id).filter(employee.id < 5) | ||
|
||
result = proj.select( | ||
[ | ||
proj.first_name, | ||
proj.last_name, | ||
proj.id, | ||
call.start_time, | ||
call.end_time, | ||
call.employee_id, | ||
call.call_outcome_id, | ||
call.call_attempts, | ||
proj.first_name.name("first"), | ||
] | ||
).order_by(proj.id.desc()) |
38 changes: 38 additions & 0 deletions
38
ibis/expr/tests/snapshots/test_sql/test_parse_sql_multiple_joins/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import ibis | ||
|
||
|
||
call_outcome = ibis.table( | ||
name="call_outcome", schema={"outcome_text": "string", "id": "int64"} | ||
) | ||
employee = ibis.table( | ||
name="employee", | ||
schema={"first_name": "string", "last_name": "string", "id": "int64"}, | ||
) | ||
call = ibis.table( | ||
name="call", | ||
schema={ | ||
"start_time": "timestamp", | ||
"end_time": "timestamp", | ||
"employee_id": "int64", | ||
"call_outcome_id": "int64", | ||
"call_attempts": "int64", | ||
}, | ||
) | ||
innerjoin = employee.inner_join(call, employee.id == call.employee_id) | ||
|
||
result = innerjoin.inner_join( | ||
call_outcome, call.call_outcome_id == call_outcome.id | ||
).select( | ||
[ | ||
innerjoin.first_name, | ||
innerjoin.last_name, | ||
innerjoin.id, | ||
innerjoin.start_time, | ||
innerjoin.end_time, | ||
innerjoin.employee_id, | ||
innerjoin.call_outcome_id, | ||
innerjoin.call_attempts, | ||
call_outcome.outcome_text, | ||
call_outcome.id.name("id_right"), | ||
] | ||
) |
16 changes: 16 additions & 0 deletions
16
ibis/expr/tests/snapshots/test_sql/test_parse_sql_scalar_subquery/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import ibis | ||
|
||
|
||
call = ibis.table( | ||
name="call", | ||
schema={ | ||
"start_time": "timestamp", | ||
"end_time": "timestamp", | ||
"employee_id": "int64", | ||
"call_outcome_id": "int64", | ||
"call_attempts": "int64", | ||
}, | ||
) | ||
agg = call.aggregate(call.call_attempts.mean().name("mean")) | ||
|
||
result = call.inner_join(agg, []) |
15 changes: 15 additions & 0 deletions
15
ibis/expr/tests/snapshots/test_sql/test_parse_sql_simple_reduction/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import ibis | ||
|
||
|
||
call = ibis.table( | ||
name="call", | ||
schema={ | ||
"start_time": "timestamp", | ||
"end_time": "timestamp", | ||
"employee_id": "int64", | ||
"call_outcome_id": "int64", | ||
"call_attempts": "int64", | ||
}, | ||
) | ||
|
||
result = call.aggregate(call.call_attempts.mean().name("mean")) |
9 changes: 9 additions & 0 deletions
9
ibis/expr/tests/snapshots/test_sql/test_parse_sql_simple_select_count/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import ibis | ||
|
||
|
||
employee = ibis.table( | ||
name="employee", | ||
schema={"first_name": "string", "last_name": "string", "id": "int64"}, | ||
) | ||
|
||
result = employee.aggregate(employee.first_name.count().name("_col_0")) |
9 changes: 9 additions & 0 deletions
9
ibis/expr/tests/snapshots/test_sql/test_parse_sql_table_alias/decompiled.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import ibis | ||
|
||
|
||
employee = ibis.table( | ||
name="employee", | ||
schema={"first_name": "string", "last_name": "string", "id": "int64"}, | ||
) | ||
|
||
result = employee.select([employee.first_name, employee.last_name, employee.id]) |
Oops, something went wrong.