summaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Functions/nowInBlock.cpp
diff options
context:
space:
mode:
authorAlexSm <[email protected]>2024-01-04 15:09:05 +0100
committerGitHub <[email protected]>2024-01-04 15:09:05 +0100
commitdab291146f6cd7d35684e3a1150e5bb1c412982c (patch)
tree36ef35f6cacb6432845a4a33f940c95871036b32 /contrib/clickhouse/src/Functions/nowInBlock.cpp
parent63660ad5e7512029fd0218e7a636580695a24e1f (diff)
Library import 5, delete go dependencies (#832)
* Library import 5, delete go dependencies * Fix yt client
Diffstat (limited to 'contrib/clickhouse/src/Functions/nowInBlock.cpp')
-rw-r--r--contrib/clickhouse/src/Functions/nowInBlock.cpp95
1 files changed, 0 insertions, 95 deletions
diff --git a/contrib/clickhouse/src/Functions/nowInBlock.cpp b/contrib/clickhouse/src/Functions/nowInBlock.cpp
deleted file mode 100644
index 0d5f9c45780..00000000000
--- a/contrib/clickhouse/src/Functions/nowInBlock.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-#include <Functions/IFunction.h>
-#include <Functions/FunctionFactory.h>
-#include <Functions/extractTimeZoneFromFunctionArguments.h>
-#include <DataTypes/DataTypeDateTime.h>
-#include <Columns/ColumnsDateTime.h>
-#include <Columns/ColumnVector.h>
-#include <Interpreters/Context.h>
-
-
-namespace DB
-{
-
-namespace ErrorCodes
-{
- extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
- extern const int ILLEGAL_TYPE_OF_ARGUMENT;
-}
-
-namespace
-{
-
-/** Returns current time at calculation of every block.
- * In contrast to 'now' function, it's not a constant expression and is not a subject of constant folding.
- */
-class FunctionNowInBlock : public IFunction
-{
-public:
- static constexpr auto name = "nowInBlock";
- static FunctionPtr create(ContextPtr context)
- {
- return std::make_shared<FunctionNowInBlock>(context);
- }
- explicit FunctionNowInBlock(ContextPtr context)
- : allow_nonconst_timezone_arguments(context->getSettings().allow_nonconst_timezone_arguments)
- {}
-
- String getName() const override
- {
- return name;
- }
-
- bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override
- {
- return false;
- }
-
- /// Optional timezone argument.
- bool isVariadic() const override { return true; }
-
- size_t getNumberOfArguments() const override { return 0; }
-
- bool isDeterministic() const override
- {
- return false;
- }
-
- bool isDeterministicInScopeOfQuery() const override
- {
- return false;
- }
-
- DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
- {
- if (arguments.size() > 1)
- {
- throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Arguments size of function {} should be 0 or 1", getName());
- }
- if (arguments.size() == 1 && !isStringOrFixedString(arguments[0].type))
- {
- throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Arguments of function {} should be String or FixedString",
- getName());
- }
- if (arguments.size() == 1)
- {
- return std::make_shared<DataTypeDateTime>(extractTimeZoneNameFromFunctionArguments(arguments, 0, 0, allow_nonconst_timezone_arguments));
- }
- return std::make_shared<DataTypeDateTime>();
- }
-
- ColumnPtr executeImpl(const ColumnsWithTypeAndName &, const DataTypePtr &, size_t input_rows_count) const override
- {
- return ColumnDateTime::create(input_rows_count, static_cast<UInt32>(time(nullptr)));
- }
-private:
- const bool allow_nonconst_timezone_arguments;
-};
-
-}
-
-REGISTER_FUNCTION(NowInBlock)
-{
- factory.registerFunction<FunctionNowInBlock>();
-}
-
-}