27 #define DEFAULT_ROW_MULTIPLIER_SUFFIX "__default_RowMultiplier_"
28 #define DEFAULT_ROW_MULTIPLIER_VALUE 1
29 #define PREFLIGHT_SUFFIX "__preflight"
102 namespace table_functions {
130 const std::vector<ExtArgumentType>& input_args,
131 const std::vector<ExtArgumentType>& output_args,
132 const std::vector<ExtArgumentType>& sql_args,
133 const std::vector<std::map<std::string, std::string>>& annotations,
145 std::vector<ExtArgumentType>
getArgs(
const bool ensure_column =
false)
const {
146 std::vector<ExtArgumentType>
args;
176 std::string
getSignature(
const bool include_name,
const bool include_output)
const;
234 const std::map<std::string, std::string>
getAnnotations(
const size_t idx)
const;
236 const size_t input_arg_idx)
const;
238 const std::string& key,
239 const std::string& default_)
const;
241 const size_t output_arg_idx)
const;
243 const std::string& key,
244 const std::string& default_)
const;
246 const std::string& default_)
const;
249 const std::vector<std::string>
getCursorFields(
const size_t sql_idx)
const;
250 const std::string
getArgTypes(
const bool use_input_args)
const;
251 const std::string
getArgNames(
const bool use_input_args)
const;
253 std::pair<int32_t, int32_t>
getInputID(
const size_t idx)
const;
260 size_t col_index = 0;
261 size_t func_arg_index = 0;
262 for (
const auto& ti : variant) {
264 if (ti.is_column_list()) {
265 col_index += ti.get_dimension();
269 if (func_arg_index == val) {
292 return (
name_.find(
"_default_",
name_.find(
"__")) != std::string::npos);
296 auto result =
"TableFunction(" +
name_ +
", input_args=[";
298 result +=
"], output_args=[";
300 result +=
"], sql_args=[";
305 result +=
", annotations=[";
307 if (annotation.empty()) {
311 for (
auto it : annotation) {
343 static void add(
const std::string&
name,
345 const std::vector<ExtArgumentType>& input_args,
346 const std::vector<ExtArgumentType>& output_args,
347 const std::vector<ExtArgumentType>& sql_args,
348 const std::vector<std::map<std::string, std::string>>& annotations,
349 bool is_runtime =
false);
351 static std::vector<TableFunction>
get_table_funcs(
const std::string& name,
353 static std::vector<TableFunction>
get_table_funcs(
const std::string& name);
354 static std::vector<TableFunction>
get_table_funcs(
const bool is_runtime);
356 template <const
char* filename>
361 static std::unordered_map<std::string, TableFunction>
functions_;
363 friend class ::ExtensionFunctionsWhitelist;
SQLTypeInfo getOutputSQLType(const size_t idx) const
const std::string getOutputAnnotation(const size_t output_arg_idx, const std::string &key, const std::string &default_) const
std::string drop_suffix(const std::string &str)
static std::vector< TableFunction > get_table_funcs()
size_t getInputsSize() const
bool hasUserSpecifiedOutputSizeParameter() const
static void add(const std::string &name, const TableFunctionOutputRowSizer sizer, const std::vector< ExtArgumentType > &input_args, const std::vector< ExtArgumentType > &output_args, const std::vector< ExtArgumentType > &sql_args, const std::vector< std::map< std::string, std::string >> &annotations, bool is_runtime=false)
const TableFunctionOutputRowSizer output_sizer_
bool hasUserSpecifiedOutputSizeMultiplier() const
size_t getOutputsSize() const
size_t getSqlOutputRowSizeParameter() const
const std::map< std::string, std::string > getFunctionAnnotations() const
TableFunction(const std::string &name, const TableFunctionOutputRowSizer output_sizer, const std::vector< ExtArgumentType > &input_args, const std::vector< ExtArgumentType > &output_args, const std::vector< ExtArgumentType > &sql_args, const std::vector< std::map< std::string, std::string >> &annotations, bool is_runtime, bool uses_manager)
const std::vector< std::map< std::string, std::string > > annotations_
std::string toString() const
const std::vector< ExtArgumentType > output_args_
std::pair< int32_t, int32_t > getInputID(const size_t idx) const
const std::string getFunctionAnnotation(const std::string &key, const std::string &default_) const
size_t getOutputRowSizeParameter() const
ExtArgumentType ext_arg_type_ensure_column(const ExtArgumentType ext_arg_type)
std::string getSignature(const bool include_name, const bool include_output) const
bool hasOutputSizeKnownPreLaunch() const
bool containsPreFlightFn() const
const std::vector< ExtArgumentType > sql_args_
Supported runtime functions management and retrieval.
SQLTypeInfo getInputSQLType(const size_t idx) const
bool hasNonUserSpecifiedOutputSize() const
const std::string getArgNames(const bool use_input_args) const
std::vector< ExtArgumentType > getArgs(const bool ensure_column=false) const
int32_t countScalarArgs() const
std::string toString() const
std::string getPreFlightFnName() const
bool useDefaultSizer() const
const std::map< std::string, std::string > getOutputAnnotations(const size_t output_arg_idx) const
const std::vector< ExtArgumentType > & getOutputArgs() const
const std::string getInputAnnotation(const size_t input_arg_idx, const std::string &key, const std::string &default_) const
std::string getName(const bool drop_suffix=false, const bool lower=false) const
bool hasUserSpecifiedOutputSizeConstant() const
const std::string getArgTypes(const bool use_input_args) const
const std::string getInputArgsDefaultValues() const
bool hasPreFlightOutputSizer() const
const std::vector< std::string > getCursorFields(const size_t sql_idx) const
std::string toStringSQL() const
const std::vector< ExtArgumentType > & getInputArgs() const
bool hasTableFunctionSpecifiedParameter() const
bool hasCompileTimeOutputSizeConstant() const
const std::map< std::string, std::string > getInputAnnotations(const size_t input_arg_idx) const
static std::string toString(const std::vector< ExtensionFunction > &ext_funcs, std::string tab="")
const std::vector< ExtArgumentType > & getSqlArgs() const
bool hasConstantOutputSize() const
static std::unordered_map< std::string, TableFunction > functions_
const std::vector< ExtArgumentType > input_args_
bool hasOutputSizeIndependentOfInputSize() const
void init_table_functions()
size_t getOutputRowSizeParameter(const std::vector< SQLTypeInfo > &variant) const
OutputBufferSizeType getOutputRowSizeType() const
const ExtArgumentType getRet() const
static std::string toStringSQL(const std::vector< ExtArgumentType > &sig_types)
const std::vector< std::map< std::string, std::string > > & getAnnotations() const