Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
goodwanghan authored Mar 16, 2024
1 parent 493d5f1 commit f553a4d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fugue_ibis/execution_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,10 @@ def take(
pcols = ", ".join(
self.encode_column_name(x) for x in partition_spec.partition_by
)
dummy_order_by = self._dummy_window_order_by()
sql = (
f"SELECT * FROM ("
f"SELECT *, ROW_NUMBER() OVER (PARTITION BY {pcols}) "
f"SELECT *, ROW_NUMBER() OVER (PARTITION BY {pcols} {dummy_order_by}) "
f"AS __fugue_take_param FROM {tbn}"
f") WHERE __fugue_take_param<={n}"
)
Expand Down Expand Up @@ -290,6 +291,12 @@ def save_table(
def load_table(self, table: str, **kwargs: Any) -> DataFrame:
return self.to_df(self.backend.table(table))

def _dummy_window_order_by(self) -> str:
"""Return a dummy window order by clause, this is required for
some SQL backends when there is no real order by clause in window
"""
return ""


class IbisMapEngine(MapEngine):
"""IbisExecutionEngine's MapEngine, it is a wrapper of the map engine
Expand Down

0 comments on commit f553a4d

Please sign in to comment.