infiniflow / infiniflow/infinity
[Bug]: Thrift SDK crashes rendering explain output with constants (limit/offset/filter literal)
- 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
Over the thrift protocol, table._to_string (python/infinity_sdk/infinity/remote_thrift/table.py) renders an explain result by calling parsed_expression_to_string (python/infinity_sdk/infinity/remote_thrift/utils.py) on each parsed expression. parsed_expression_to_string reads constant literal values from the wrong object - expr_type (ParsedExprType) instead of expr_type.constant_expr - so any explain output containing a constant (limit, offset, a literal in a filter, ...) crashes:
AttributeError: 'ParsedExprType' object has no attribute 'i64_value'
Only the Boolean branch reads from constant_expr; Int64, Double, String, and all the array/tensor branches are broken. The two tensor-array branches additionally use stale field names missing the _value suffix (i64_tensor_array / f64_tensor_array instead of i64_tensor_array_value / f64_tensor_array_value).
Repro (no server needed):
from infinity.remote_thrift.utils import parsed_expression_to_string
from infinity.remote_thrift.infinity_thrift_rpc import ttypes
constant_expr = ttypes.ConstantExpr(literal_type=ttypes.LiteralType.Int64, i64_value=10)
expr_type = ttypes.ParsedExprType(); expr_type.constant_expr = constant_expr
expr = ttypes.ParsedExpr(); expr.type = expr_type
parsed_expression_to_string(expr) # AttributeError
### Expected behavior
Every literal branch renders the constant value from constant_expr: "10" for the repro above, and matching strings for Double/String/Boolean/array/tensor literals.
### Additional information
Fix: read all constant values from constant_expr and correct the tensor-array field names, plus a regression test (test_parsed_expression_to_string_constants in python/test_pysdk/test_explain.py) covering every literal branch. PR coming.
Contributor guide
Research direction
Start in python/infinity_sdk/infinity/remote_thrift/utils.py at parsed_expression_to_string, then inspect table.py to understand how explain output uses it. Run the reproduction from the issue and read test_pysdk/test_explain.py. Done means every literal branch renders without crashing and test_parsed_expression_to_string_constants covers the documented literal cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100