infiniflow / infiniflow/infinity
Thrift SDK to_string() misrenders zero-argument functions and IN/BETWEEN filters
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 445
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 7
Description
Describe the bug
RemoteTable.to_string() misrenders three kinds of expressions in parsed_expression_to_string (python/infinity_sdk/infinity/remote_thrift/utils.py):
- Zero-argument functions.
arguments_stris initialised to thestrbuiltin, so a function with no arguments renders asrow_id(<class 'str'>)instead ofrow_id(). - IN filters. The rendering is
f"{left} IN (f{arguments_str})"- a stray literalfis prepended to the argument list:c1 IN (fc2, c3). With literal arguments (after the crash fix in #3441) it rendersc1 IN (f1, 2, 3). - BETWEEN. Same stray
fon every operand, and the lower/upper bounds are printed swapped: withlower_bound=c2, upper_bound=c3it rendersbetween(fc1, fc3, fc2).
To Reproduce
from infinity.remote_thrift.infinity_thrift_rpc import ttypes
from infinity.remote_thrift.utils import parsed_expression_to_string
def col(name):
return ttypes.ParsedExpr(type=ttypes.ParsedExprType(
column_expr=ttypes.ColumnExpr(column_name=[name], star=False)))
f = ttypes.ParsedExpr(type=ttypes.ParsedExprType(
function_expr=ttypes.FunctionExpr(function_name="row_id", arguments=[])))
print(parsed_expression_to_string(f)) # "row_id(<class 'str'>)"
i = ttypes.ParsedExpr(type=ttypes.ParsedExprType(
in_expr=ttypes.InExpr(left_operand=col("c1"), arguments=[col("c2"), col("c3")], in_type=True)))
print(parsed_expression_to_string(i)) # "c1 IN (fc2, c3)"
b = ttypes.ParsedExpr(type=ttypes.ParsedExprType(
between_expr=ttypes.BetweenExpr(value=col("c1"), lower_bound=col("c2"), upper_bound=col("c3"))))
print(parsed_expression_to_string(b)) # "between(fc1, fc3, fc2)" - f-prefix + bounds swapped
Verified on current main (eca7266), output identical across runs. Reachable through the public path, e.g. table.filter("row_id() = c2").to_string() renders "=(row_id(<class 'str'>), c2)".
Expected behavior
row_id(), c1 IN (c2, c3), between(c1, c2, c3).
Proposed fix
Join the arguments with ", ".join(...) instead of the manual arguments_str = str loop, drop the stray f prefixes, and print BETWEEN as (value, lower, upper).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in python/infinity_sdk/infinity/remote_thrift/utils.py at parsed_expression_to_string, then reproduce the three cases from the issue and the public table.filter(...).to_string() path. Done means zero-argument functions render as row_id(), IN filters have no stray f, and BETWEEN prints value, lower, upper in that order.
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