mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 02:21:59 +00:00
support jit for identity
This commit is contained in:
parent
47971c9d7a
commit
664f565cee
@ -2,6 +2,10 @@
|
||||
#include <Functions/IFunction.h>
|
||||
#include <Interpreters/Context_fwd.h>
|
||||
|
||||
#if USE_EMBEDDED_COMPILER
|
||||
# include <DataTypes/Native.h>
|
||||
# include <llvm/IR/IRBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -11,6 +15,11 @@ namespace ErrorCodes
|
||||
extern const int BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
struct IdentityName
|
||||
{
|
||||
static constexpr auto name = "identity";
|
||||
};
|
||||
|
||||
template<typename Name>
|
||||
class FunctionIdentityBase : public IFunction
|
||||
{
|
||||
@ -32,12 +41,21 @@ public:
|
||||
{
|
||||
return arguments.front().column;
|
||||
}
|
||||
|
||||
#if USE_EMBEDDED_COMPILER
|
||||
bool isCompilableImpl(const DataTypes & /*types*/, const DataTypePtr & result_type) const override
|
||||
{
|
||||
return Name::name == IdentityName::name && canBeNativeType(result_type);
|
||||
}
|
||||
|
||||
llvm::Value *
|
||||
compileImpl(llvm::IRBuilderBase & /*builder*/, const ValuesWithType & arguments, const DataTypePtr & /*result_type*/) const override
|
||||
{
|
||||
return arguments[0].value;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
struct IdentityName
|
||||
{
|
||||
static constexpr auto name = "identity";
|
||||
};
|
||||
|
||||
struct ScalarSubqueryResultName
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user