infiniflow / infiniflow/infinity

[Bug]: Python SDK to_string() crashes with AttributeError on queries with limit/offset or literal filters

Open Beginner friendly
#3,440 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
4.7k
Forks
445
Avg merge
2d 2h
Merged PRs (30d)
7

Description

### Is there an existing issue for the same bug?

- [x] I have checked the existing issues.

### Version or Commit ID

main @ 4954148 (current main as of 2026-09-08)

### Other environment information

```Markdown

```

### Actual behavior and How to reproduce it

parsed_expression_to_string() in python/infinity_sdk/infinity/remote_thrift/utils.py reads literal values from the wrong object: expr_type.i64_value / f64_value / str_value / i64_array_value / ... instead of expr_type.constant_expr.. Only the Boolean case uses the right object. ParsedExprType has no such attributes, so RemoteTable.to_string() raises AttributeError on any query carrying a limit, an offset, or a literal in its filter.

Repro (no server needed):

from infinity.remote_thrift.table import RemoteTable
t = RemoteTable(conn=None, db_name="default_db", table_name="t")
t.output(["c1"]).limit(10).to_string()
# AttributeError: 'ParsedExprType' object has no attribute 'i64_value'

Also crashes: .filter("c2 > 3"), .offset(5), or a string literal like .filter("name = 'abc'").

### Expected behavior

to_string() returns the JSON description of the query, e.g. {"db": "default_db", "table": "t", "columns": ["c1"], "limit": "10"}.

### Additional information

Fix: read the fields from expr_type.constant_expr in every literal case. PR with the fix plus a regression test (filter + limit + offset through to_string()) coming.

Contributor guide

Open the contributing guide

Research direction

Start in python/infinity_sdk/infinity/remote_thrift/utils.py, where parsed_expression_to_string() serializes query expressions, and follow RemoteTable.to_string() from the reproduction. Run the no-server examples for filter, limit, and offset, then add or run the regression coverage mentioned in the issue. Done means these cases return the expected JSON description without AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.