-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow prepared statemenet parameter in CALL function (#4628)
- Loading branch information
1 parent
ca95412
commit 2bb28c2
Showing
27 changed files
with
170 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if (${BUILD_EXTENSION_TESTS}) | ||
add_kuzu_test(fts_prepare_test prepare_test.cpp) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "main_test_helper/main_test_helper.h" | ||
|
||
using namespace kuzu::common; | ||
|
||
namespace kuzu { | ||
namespace testing { | ||
|
||
TEST_F(ApiTest, PrepareFTSTest) { | ||
createDBAndConn(); | ||
ASSERT_TRUE(conn->query(common::stringFormat("LOAD EXTENSION '{}'", | ||
TestHelper::appendKuzuRootPath( | ||
"extension/fts/build/libfts.kuzu_extension"))) | ||
->isSuccess()); | ||
ASSERT_TRUE( | ||
conn->query("CALL CREATE_FTS_INDEX('person', 'personIdx', ['fName'])")->isSuccess()); | ||
auto prepared = | ||
conn->prepare("CALL QUERY_FTS_INDEX('person', 'personIdx', $q) RETURN node.ID, score;"); | ||
auto preparedResult = TestHelper::convertResultToString( | ||
*conn->execute(prepared.get(), std::make_pair(std::string("q"), std::string("alice")))); | ||
auto nonPreparedResult = TestHelper::convertResultToString(*conn->query( | ||
"CALL QUERY_FTS_INDEX('person', 'personIdx', 'alice') RETURN node.ID, score;")); | ||
sortAndCheckTestResults(preparedResult, nonPreparedResult); | ||
} | ||
|
||
} // namespace testing | ||
} // namespace kuzu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "function/table/bind_input.h" | ||
|
||
#include "binder/expression/literal_expression.h" | ||
|
||
namespace kuzu { | ||
namespace function { | ||
|
||
void TableFuncBindInput::addLiteralParam(common::Value value) { | ||
params.push_back(std::make_shared<binder::LiteralExpression>(std::move(value), "")); | ||
} | ||
|
||
template<typename T> | ||
T TableFuncBindInput::getLiteralVal(common::idx_t idx) const { | ||
KU_ASSERT(params[idx]->expressionType == common::ExpressionType::LITERAL); | ||
return params[idx]->constCast<binder::LiteralExpression>().getValue().getValue<T>(); | ||
} | ||
|
||
template KUZU_API std::string TableFuncBindInput::getLiteralVal<std::string>( | ||
common::idx_t idx) const; | ||
template KUZU_API uint64_t TableFuncBindInput::getLiteralVal<uint64_t>(common::idx_t idx) const; | ||
template KUZU_API uint32_t TableFuncBindInput::getLiteralVal<uint32_t>(common::idx_t idx) const; | ||
template KUZU_API uint8_t* TableFuncBindInput::getLiteralVal<uint8_t*>(common::idx_t idx) const; | ||
|
||
} // namespace function | ||
} // namespace kuzu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.