infiniflow / infinity

The AI-native database built for LLM applications, providing incredibly fast hybrid search of dense vector, sparse vector, tensor (multi-vector), and full-text
https://infiniflow.org
Apache License 2.0
2.68k stars 275 forks source link

[Bug]: Corruption of full text search #2251

Closed yingfeng closed 6 days ago

yingfeng commented 6 days ago

Is there an existing issue for the same bug?

Version or Commit ID

1dacf471c2efba76b1de21459ff289432a0ade9d

Other environment information

No response

Actual behavior and How to reproduce it

CREATE TABLE cmcc(content varchar default '',id varchar default '');

CREATE INDEX ft_index ON cmcc(content) USING FULLTEXT WITH (analyzer=standard);

Given full text query:

SELECT id, SCORE()  FROM cmcc SEARCH MATCH TEXT('content', '((互联网 OR "联网" OR ("联网"~2)^0.5)^0.37996928602305424 (服务)^0.37996928602305424 (文章)^0.13455624904801738 (系统)^0.10443628332697895 (\+)^0.0004189177488833171 (监管)^0.00020561620385239324 (提到)^0.0001805935548173221 (提供)^0.00013985485008990281 (主要)^0.00012391322125226468 ("文章 提到 互联网 + 监管 系统 主要 提供 服务"~4)^1.5)');

Segmentation fault:

0x000055555a46f17a in infinity::QueryNode::MultiplyWeight (this=0x0, factor=0.000418917742)
    at /home/infominer/codebase/workspace/infinity/src/storage/invertedindex/search/query_node.h:84
84      void MultiplyWeight(float factor) { weight_ *= factor; }
(gdb) p weight_
Cannot access memory at address 0xc
(gdb) bt
#0  0x000055555a46f17a in infinity::QueryNode::MultiplyWeight (this=0x0, factor=0.000418917742)
    at /home/infominer/codebase/workspace/infinity/src/storage/invertedindex/search/query_node.h:84
#1  0x000055555b1f07ae in infinity::SearchParser::parse (this=0x507000040bb0) at /home/infominer/codebase/workspace/infinity/cmake-build-debug/search_parser.y:140
#2  0x000055555a47946b in infinity::SearchDriver::ParseSingle (this=0x7ffea6f2df00, query=..., default_field_ptr=0x5030001a5540)
    at /home/infominer/codebase/workspace/infinity/src/storage/invertedindex/search/search_driver.cpp:177
#3  0x000055555a478530 in infinity::SearchDriver::ParseSingleWithFields (this=0x7ffea6f2df00, fields_str=..., query=...)
    at /home/infominer/codebase/workspace/infinity/src/storage/invertedindex/search/search_driver.cpp:81
#4  0x000055555a133fff in infinity::BoundSelectStatement@bound_select_statement::BuildPlan(infinity::QueryContext@query_context*) (this=0x514000023e40,
    query_context=0x511000022280) at /home/infominer/codebase/workspace/infinity/src/planner/bound_select_statement.cpp:285
#5  0x0000555557074608 in infinity::LogicalPlanner@logical_planner::BuildSelect(infinity::SelectStatement const*, std::__1::shared_ptr<infinity::BindContext@bind_context>&) (this=0x5070000404b0, statement=0x50f0000106c0, bind_context_ptr=...) at /home/infominer/codebase/workspace/infinity/src/planner/logical_planner.cpp:246
#6  0x0000555557072e94 in infinity::LogicalPlanner@logical_planner::Build(infinity::BaseStatement const*, std::__1::shared_ptr<infinity::BindContext@bind_context>&) (
    this=0x5070000404b0, statement=0x50f0000106c0, bind_context_ptr=...) at /home/infominer/codebase/workspace/infinity/src/planner/logical_planner.cpp:117
#7  0x000055555702f239 in infinity::QueryContext@query_context::QueryStatement(infinity::BaseStatement const*) (this=0x511000022280, base_statement=0x50f0000106c0)
    at /home/infominer/codebase/workspace/infinity/src/main/query_context.cpp:213
#8  0x000055555702dceb in infinity::QueryContext@query_context::Query(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) (
    this=0x511000022280, query=...) at /home/infominer/codebase/workspace/infinity/src/main/query_context.cpp:124
#9  0x00005555593fb6ca in infinity::Connection@connection::HandlerSimpleQuery(infinity::QueryContext@query_context*) (this=0x50700002ee88, query_context=0x511000022280)
    at /home/infominer/codebase/workspace/infinity/src/network/connection.cpp:162

Expected behavior

No response

Additional information

No response