Skip to content

Commit

Permalink
Add group by doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
small-turtle-1 committed Jan 23, 2025
1 parent ca06d05 commit 31fb191
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/references/http_api_reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1776,6 +1776,7 @@ Searches for data in a specified table. The search can range from a simple vecto
- `"filter"`: `string`
- `"fusion"`: `object`
- `"sort"` : `object[]`
- `"group_by"`: `string[]`
- `"limit"` : `string`
- `"offset"` : `string`
- `"option"` : `object`
Expand Down Expand Up @@ -2013,6 +2014,9 @@ curl --request GET \
- `"sort"` : `object[]`
Defines how to sort the results.
- `"group_by"`: `string[]`
Indicates the expression to group by.
- `"limit"` : `string`
Indicates the limit row count.
Expand Down
30 changes: 30 additions & 0 deletions docs/references/pysdk_api_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,36 @@ table_obj.output(["c1", "c2"]).sort([["c2", SortType.Asc], ["c1", SortType.Desc]

---

### group_by

```python
table_object.group_by(group_by_columns)
```

Creates a group-by expression using `group_by_columns`.

#### Parameters

##### group_by_columns: `list[str] | str`, *Required*

A list of strings specifying the expression to group by. Each string in the list represents a column name or an expression.

#### Returns

- Success: An `infinity.local_infinity.table.LocalTable` object in embedded mode or an `infinity.remote_thrift.table.RemoteTable` object in client-server mode.
- Failure: `InfinityException`
- `error_code`: `int` A non-zero value indicating a specific error condition.
- `error_msg`: `str` A message providing additional details about the error.

#### Examples

```python
table_obj.output(["c1", "sum(c2)"]).group_by(["c1"]).to_df()
table_obj.output(["c1", "avg(c1)", "count(c2)", "min(c3)", "max(c4)"]).group_by(["c1", "c1+c2"]).to_df()
```

---

### limit

```python
Expand Down

0 comments on commit 31fb191

Please sign in to comment.