#pragma once #include #include #include #include namespace DB { struct UserDefinedExecutableFunctionArgument { DataTypePtr type; String name; }; struct UserDefinedExecutableFunctionParameter { String name; DataTypePtr type; }; struct UserDefinedExecutableFunctionConfiguration { std::string name; std::string command; std::vector command_arguments; std::vector arguments; std::vector parameters; DataTypePtr result_type; String result_name; }; class UserDefinedExecutableFunction final : public IExternalLoadable { public: UserDefinedExecutableFunction( const UserDefinedExecutableFunctionConfiguration & configuration_, std::shared_ptr coordinator_, const ExternalLoadableLifetime & lifetime_); const ExternalLoadableLifetime & getLifetime() const override { return lifetime; } std::string getLoadableName() const override { return configuration.name; } bool supportUpdates() const override { return true; } bool isModified() const override { return true; } std::shared_ptr clone() const override { return std::make_shared(configuration, coordinator, lifetime); } const UserDefinedExecutableFunctionConfiguration & getConfiguration() const { return configuration; } std::shared_ptr getCoordinator() const { return coordinator; } std::shared_ptr shared_from_this() { return std::static_pointer_cast(IExternalLoadable::shared_from_this()); } std::shared_ptr shared_from_this() const { return std::static_pointer_cast(IExternalLoadable::shared_from_this()); } private: UserDefinedExecutableFunctionConfiguration configuration; std::shared_ptr coordinator; ExternalLoadableLifetime lifetime; }; }