infiniflow / infiniflow/infinity

[Bug]: HTTP SDK corrupts varchar values that look like booleans ("true"/"false"/"None") in to_df

Open
#3,442 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

The HTTP server serializes boolean columns as the strings "true"/"false" (default branch of the value switch in HTTPSearch::Search -> ColumnVector::ToString(row)), so the HTTP Python client (table_http_result.to_result in python/infinity_sdk/infinity/infinity_http.py) coerces matching strings back to booleans. But it does this for ANY string value without checking the column's declared type:

if v.lower() == 'true':
v = True
elif v.lower() == 'false':
v = False
elif v.lower() == 'none':
v = None

So a varchar cell containing "true" comes back as True (rendered "True" in the string DataFrame column), "false" as False, and "None" as a null - stored data is corrupted on read. Nulls are already carried by the _bitmap fields, so this coercion is only ever needed for actual boolean columns.

Repro (stub the net layer, feed the exact JSON shape the server produces):

SERVER_JSON = {"error_code": 0, "output": [
[{"name": "true", "name_bitmap": True}, {"flag": "true", "flag_bitmap": True}],
[{"name": "None", "name_bitmap": True}, {"flag": "false", "flag_bitmap": True}],
]}
# table columns: name varchar, flag bool
# to_df() -> name: ["True", ] (expected: ["true", "None"])
# flag: [True, False] (correct)

### Expected behavior

Varchar data passes through verbatim: "true" stays "true", "None" stays "None". Only columns whose declared type is boolean (and untyped expression results, e.g. "c1 > c2") get the "true"/"false" string coercion.

### Additional information

Fix: gate the coercion on the declared column type from show_columns_type() (keeping it for expression columns with no declared type). PR with the fix plus a regression test (round-trips "true"/"None"/"false" through a varchar column) coming.

Contributor guide

Open the contributing guide

Research direction

Start in python/infinity_sdk/infinity/infinity_http.py at table_http_result.to_result, then inspect how show_columns_type() supplies declared types. Reproduce the issue with the provided SERVER_JSON shape and add a regression test covering varchar values "true", "None", and "false"; done means those strings pass through while boolean columns and untyped expression results retain their expected coercion.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
api, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.