mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #29755 from Joeywzr/new_func
add function getOSKernelVersion
This commit is contained in:
commit
daf9cf12d9
@ -81,6 +81,7 @@ void registerFunctionQueryID(FunctionFactory & factory);
|
|||||||
void registerFunctionInitialQueryID(FunctionFactory & factory);
|
void registerFunctionInitialQueryID(FunctionFactory & factory);
|
||||||
void registerFunctionServerUUID(FunctionFactory &);
|
void registerFunctionServerUUID(FunctionFactory &);
|
||||||
void registerFunctionZooKeeperSessionUptime(FunctionFactory &);
|
void registerFunctionZooKeeperSessionUptime(FunctionFactory &);
|
||||||
|
void registerFunctionGetOSKernelVersion(FunctionFactory &);
|
||||||
|
|
||||||
#if USE_ICU
|
#if USE_ICU
|
||||||
void registerFunctionConvertCharset(FunctionFactory &);
|
void registerFunctionConvertCharset(FunctionFactory &);
|
||||||
@ -162,6 +163,7 @@ void registerFunctionsMiscellaneous(FunctionFactory & factory)
|
|||||||
registerFunctionInitialQueryID(factory);
|
registerFunctionInitialQueryID(factory);
|
||||||
registerFunctionServerUUID(factory);
|
registerFunctionServerUUID(factory);
|
||||||
registerFunctionZooKeeperSessionUptime(factory);
|
registerFunctionZooKeeperSessionUptime(factory);
|
||||||
|
registerFunctionGetOSKernelVersion(factory);
|
||||||
|
|
||||||
#if USE_ICU
|
#if USE_ICU
|
||||||
registerFunctionConvertCharset(factory);
|
registerFunctionConvertCharset(factory);
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
#include <Common/DNSResolver.h>
|
#include <Common/DNSResolver.h>
|
||||||
#include <base/DateLUT.h>
|
#include <base/DateLUT.h>
|
||||||
|
|
||||||
|
#if defined(OS_LINUX)
|
||||||
|
# include <Poco/Environment.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(ARCADIA_BUILD)
|
#if !defined(ARCADIA_BUILD)
|
||||||
# include <Common/config_version.h>
|
# include <Common/config_version.h>
|
||||||
#endif
|
#endif
|
||||||
@ -96,6 +100,17 @@ namespace
|
|||||||
}
|
}
|
||||||
static FunctionPtr create(ContextPtr context) { return std::make_shared<FunctionZooKeeperSessionUptime>(context); }
|
static FunctionPtr create(ContextPtr context) { return std::make_shared<FunctionZooKeeperSessionUptime>(context); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(OS_LINUX)
|
||||||
|
class FunctionGetOSKernelVersion : public FunctionConstantBase<FunctionGetOSKernelVersion, String, DataTypeString>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static constexpr auto name = "getOSKernelVersion";
|
||||||
|
explicit FunctionGetOSKernelVersion(ContextPtr context) : FunctionConstantBase(context, Poco::Environment::osName() + " " + Poco::Environment::osVersion()) {}
|
||||||
|
static FunctionPtr create(ContextPtr context) { return std::make_shared<FunctionGetOSKernelVersion>(context); }
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -143,5 +158,14 @@ void registerFunctionZooKeeperSessionUptime(FunctionFactory & factory)
|
|||||||
factory.registerFunction<FunctionZooKeeperSessionUptime>();
|
factory.registerFunction<FunctionZooKeeperSessionUptime>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void registerFunctionGetOSKernelVersion([[maybe_unused]] FunctionFactory & factory)
|
||||||
|
{
|
||||||
|
#if defined(OS_LINUX)
|
||||||
|
factory.registerFunction<FunctionGetOSKernelVersion>();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
Linux
|
@ -0,0 +1 @@
|
|||||||
|
WITH splitByChar(' ', getOSKernelVersion()) AS version_pair SELECT version_pair[1]
|
Loading…
Reference in New Issue
Block a user