Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix list_contains implicit casting #4044

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/function/list/list_contains_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ static std::unique_ptr<FunctionBindData> bindFunc(ScalarBindFuncInput input) {
scalarFunction->execFunc = ScalarFunction::BinaryExecListStructFunction<list_entry_t, T,
uint8_t, ListContains>;
});
return FunctionBindData::getSimpleBindData(input.arguments, LogicalType::BOOL());
auto& listType = input.arguments[0]->getDataType();
std::vector<LogicalType> paramTypes;
paramTypes.push_back(listType.copy());
paramTypes.push_back(ListType::getChildType(listType).copy());
return std::make_unique<FunctionBindData>(std::move(paramTypes), LogicalType::BOOL());
}

function_set ListContainsFunction::getFunctionSet() {
Expand Down
11 changes: 10 additions & 1 deletion test/test_files/function/list.test
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ ad
-LOG ListIn
-STATEMENT RETURN 1 IN [2,3,4], 2.0 IN [2,3,4], 3 IN [0,0,3]
---- 1
False|False|True
False|True|True
-STATEMENT RETURN [1+1] IN [[2], [3], [3,4,5]], "str" IN ["a", "Xiyang", "str"]
---- 1
True|True
Expand Down Expand Up @@ -2254,3 +2254,12 @@ a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11*a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a12*a0eebc
-STATEMENT RETURN [[23, 432], [], [NULL]];
---- 1
[[23,432],[],[]]

-CASE listContainsCast
andyfengHKU marked this conversation as resolved.
Show resolved Hide resolved
-STATEMENT CREATE NODE TABLE A(id SERIAL, primary key(id));
---- ok
-STATEMENT CREATE (:A), (:A);
---- ok
-STATEMENT MATCH (a:A) WHERE a.id IN [0] RETURN a.id;
---- 1
0
Loading