Skip to content

Commit

Permalink
feat: add utility function to filter out first rows
Browse files Browse the repository at this point in the history
  • Loading branch information
nextchamp-saqib committed Dec 10, 2024
1 parent b2070b2 commit d6a0bdf
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ def f_is_first_row(group_by, order_by, sort_order="asc"):
return f_if_else(row_number == 1, 1, 0)


def f_filter_first_row(group_by, order_by, sort_order="asc"):
_order_by = ibis.asc(order_by) if sort_order == "asc" else ibis.desc(order_by)
row_number = f_row_number().over(group_by=group_by, order_by=_order_by)
return row_number == 1


def f_create_buckets(column, num_buckets):
query = frappe.flags.current_ibis_query
if query is None:
Expand Down

0 comments on commit d6a0bdf

Please sign in to comment.