infiniflow / infiniflow/infinity
Thrift SDK explain() silently drops GROUP BY and HAVING
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 445
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 7
Description
**Description**
`table.output(...).group_by(...).having(...).explain()` over the thrift SDK explains a different query than the one that was built: `group by` and `having` never reach the server.
In `python/infinity_sdk/infinity/remote_thrift/table.py`, `_explain_query` hardcodes `group_by_list=None` when calling `conn.explain`, and `remote_thrift/client.py`'s `explain()` has no `having_expr` parameter at all - even though `ExplainRequest` in the thrift IDL has both `group_by_list` and `having_expr` fields and the server reads them. The plain `select` path forwards both correctly; only `explain` was left behind.
**Reproduction**
```python
import infinity
from infinity.table import ExplainType
inf = infinity.connect("http://localhost:23817")
db = inf.get_database("default_db")
t = db.create_table("t", {"c1": {"type": "varchar"}, "c2": {"type": "float"}})
t.insert({"c1": "a", "c2": 1.0})
res = t.output(["c1", "sum(c2)"]).group_by(["c1"]).having("sum(c2) > 0").explain(ExplainType.Physical)
print(res)
```
The physical plan contains no `Aggregate` operator - the explained statement lost its `group by` / `having`. Calling `.to_result()` on the same builder forwards both correctly, so this is specific to `explain()`. It can also be confirmed without a server by mocking the connection: `_explain_query` passes `group_by_list=None` no matter what the query holds.
Contributor guide
Research direction
Start in python/infinity_sdk/infinity/remote_thrift/table.py at _explain_query, then compare its connection call with the forwarding used by the plain select path. Read remote_thrift/client.py explain() and the ExplainRequest fields in the thrift IDL. Use a mocked connection to verify that group_by and having reach explain, and confirm the reproduced physical plan retains the aggregate query.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100