-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1737 from kuzudb/call-statement
Make table functions as part of the reading clause
- Loading branch information
Showing
49 changed files
with
3,101 additions
and
2,933 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 was deleted.
Oops, something went wrong.
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,22 @@ | ||
#include "binder/binder.h" | ||
#include "binder/call/bound_standalone_call.h" | ||
#include "parser/call/standalone_call.h" | ||
|
||
namespace kuzu { | ||
namespace binder { | ||
|
||
std::unique_ptr<BoundStatement> Binder::bindStandaloneCall(const parser::Statement& statement) { | ||
auto& callStatement = reinterpret_cast<const parser::StandaloneCall&>(statement); | ||
auto option = main::DBConfig::getOptionByName(callStatement.getOptionName()); | ||
if (option == nullptr) { | ||
throw common::BinderException{ | ||
"Invalid option name: " + callStatement.getOptionName() + "."}; | ||
} | ||
auto optionValue = expressionBinder.bindLiteralExpression(*callStatement.getOptionValue()); | ||
// TODO(Ziyi): add casting rule for option value. | ||
ExpressionBinder::validateExpectedDataType(*optionValue, option->parameterType); | ||
return std::make_unique<BoundStandaloneCall>(*option, std::move(optionValue)); | ||
} | ||
|
||
} // namespace binder | ||
} // 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 was deleted.
Oops, something went wrong.
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,34 @@ | ||
#pragma once | ||
|
||
#include "binder/expression/expression.h" | ||
#include "binder/query/reading_clause/bound_reading_clause.h" | ||
#include "function/table_operations.h" | ||
|
||
namespace kuzu { | ||
namespace binder { | ||
|
||
class BoundInQueryCall : public BoundReadingClause { | ||
public: | ||
BoundInQueryCall(function::table_func_t tableFunc, | ||
std::unique_ptr<function::TableFuncBindData> bindData, expression_vector outputExpressions) | ||
: BoundReadingClause{common::ClauseType::InQueryCall}, tableFunc{std::move(tableFunc)}, | ||
bindData{std::move(bindData)}, outputExpressions{std::move(outputExpressions)} {} | ||
|
||
inline function::table_func_t getTableFunc() const { return tableFunc; } | ||
|
||
inline function::TableFuncBindData* getBindData() const { return bindData.get(); } | ||
|
||
inline expression_vector getOutputExpressions() const { return outputExpressions; } | ||
|
||
inline std::unique_ptr<BoundReadingClause> copy() override { | ||
return std::make_unique<BoundInQueryCall>(tableFunc, bindData->copy(), outputExpressions); | ||
} | ||
|
||
private: | ||
function::table_func_t tableFunc; | ||
std::unique_ptr<function::TableFuncBindData> bindData; | ||
expression_vector outputExpressions; | ||
}; | ||
|
||
} // namespace binder | ||
} // 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include "parser/expression/parsed_expression.h" | ||
#include "parser/query/reading_clause/reading_clause.h" | ||
|
||
namespace kuzu { | ||
namespace parser { | ||
|
||
class InQueryCall : public ReadingClause { | ||
public: | ||
InQueryCall(std::string optionName, std::unique_ptr<ParsedExpression> optionValue) | ||
: ReadingClause{common::ClauseType::InQueryCall}, funcName{std::move(optionName)}, | ||
parameter{std::move(optionValue)} {} | ||
|
||
inline std::string getFuncName() const { return funcName; } | ||
|
||
inline ParsedExpression* getParameter() const { return parameter.get(); } | ||
|
||
private: | ||
std::string funcName; | ||
std::unique_ptr<ParsedExpression> parameter; | ||
}; | ||
|
||
} // namespace parser | ||
} // 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
Oops, something went wrong.