Skip to content

Commit ef4dc86

Browse files
committed
feat(bigquery): enable subqueries in select statements
1 parent d4f0275 commit ef4dc86

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

ibis/backends/base/sql/compiler/query_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def format_select_set(self):
300300
formatted = []
301301
for node in self.select_set:
302302
if isinstance(node, ops.Value):
303-
expr_str = self._translate(node, named=True)
303+
expr_str = self._translate(node, named=True, permit_subquery=True)
304304
elif isinstance(node, ops.TableNode):
305305
alias = context.get_ref(node)
306306
expr_str = f'{alias}.*' if alias else '*'

ibis/backends/tests/test_generic.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -842,22 +842,23 @@ def test_typeof(backend, con):
842842

843843

844844
@pytest.mark.broken(["polars"], reason="incorrect answer")
845-
@pytest.mark.notimpl(["datafusion", "bigquery", "impala", "pyspark"])
845+
@pytest.mark.notyet(["impala"], reason="can't find table in subquery")
846+
@pytest.mark.notimpl(["datafusion", "pyspark"])
846847
@pytest.mark.notyet(["dask", "mssql"], reason="not supported by the backend")
847848
def test_isin_uncorrelated(
848849
backend, batting, awards_players, batting_df, awards_players_df
849850
):
850851
expr = batting.select(
851852
"playerID",
852853
"yearID",
853-
x=batting.yearID.isin(awards_players.yearID),
854+
has_year_id=batting.yearID.isin(awards_players.yearID),
854855
).order_by(["playerID", "yearID"])
855-
result = expr.execute().x
856+
result = expr.execute().has_year_id
856857
expected = (
857858
batting_df.sort_values(["playerID", "yearID"])
858859
.reset_index(drop=True)
859860
.yearID.isin(awards_players_df.yearID)
860-
.rename("x")
861+
.rename("has_year_id")
861862
)
862863
backend.assert_series_equal(result, expected)
863864

0 commit comments

Comments
 (0)