text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|> arguments, {}, returned_value, examples, introduced_in, category};
factory.registerFunction<FunctionToRelativeMonthNum>(documentation);
}
}
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/DateTimeTransforms.h>
#include <Functions/FunctionDateOrDateTimeToSomething.h>
#incl... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/DateTimeTransforms.h>
#include <Functions/FunctionDateOrDateTimeToSomething.h>
#include <DataTypes/DataTypesNumber.h>
namespace DB
{
using FunctionToRelativeQuarterNum = FunctionDateOrDateTimeToSomething<DataTypeUInt32, ToRelativeQuarter<|fim_s... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>mentation::IntroducedIn introduced_in = {1, 1};
FunctionDocumentation::Category category = FunctionDocumentation::Category::DateAndTime;
FunctionDocumentation documentation = {description, syntax, arguments, {}, returned_value, examples, introduced_in, category};
factory.registerFunction<Func... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>int in the past.
The exact point in time is an implementation detail, and therefore this function is not intended to be used standalone.
The main purpose of the function is to calculate the difference in weeks between two dates or dates with time, e.g., `toRelativeWeekNum(dt1) - toRelativeWeekNum(dt2)`.
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>,
R"(
ββminus(toRelaβ―ateTime')))ββ
β 10 β
ββββββββββββββββββββββββββββ
)"}
};
FunctionDocumentation::IntroducedIn introduced_in = {1, 1};
FunctionDocumentation::Category category = FunctionDocumentation::Category::DateAndTime;
FunctionDocumentation doc... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/DateTimeTransforms.h>
#include <Functions/FunctionDateOrDateTimeToSomething.h>
#include <DataTypes/DataTypesNumber.h>
namespace DB
{
using FunctionToSecond = FunctionDateOrDateTimeToSomething<DataTypeUInt8, ToSecondImpl>;
REGISTER_FUNCTION(ToS... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>entation::Category category = FunctionDocumentation::Category::DateAndTime;
FunctionDocumentation documentation = {description, syntax, arguments, {}, returned_value, examples, introduced_in, category};
factory.registerFunction<FunctionToStartOfDay>(documentation);
}
}
<|fim_prefix|>#include <... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>eTime('2023-04-21 10:17:00')): 2023-04-21 10:15:00
toStartOfFifteenMinutes(toDateTime('2023-04-21 10:20:00')): 2023-04-21 10:15:00
toStartOfFifteenMinutes(toDateTime('2023-04-21 10:23:00')): 2023-04-21 10:15:00
)"}
};
FunctionDocumentation::IntroducedIn introduced_in = {1, 1};
FunctionDocu... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>mentation::Examples examples = {
{"Example", R"(
SELECT
toStartOfFiveMinutes(toDateTime('2023-04-21 10:17:00')),
toStartOfFiveMinutes(toDateTime('2023-04-21 10:20:00')),
toStartOfFiveMinutes(toDateTime('2023-04-21 10:23:00'))
FORMAT Vertical
)", R"(
Row 1:
ββββββ
toStartOfFiveM... | fim | ClickHouse/ClickHouse | cpp |
#include <Functions/FunctionFactory.h>
#include <Functions/DateTimeTransforms.h>
#include <Functions/FunctionDateOrDateTimeToDateTimeOrDateTime64.h>
namespace DB
{
using FunctionToStartOfHour = FunctionDateOrDateTimeToDateTimeOrDateTime64<ToStartOfHourImpl>;
REGISTER_FUNCTION(ToStartOfHour)
{
FunctionDocumentat... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>cumentation::Syntax syntax = R"(
toStartOfISOYear(value)
)";
FunctionDocumentation::Arguments arguments = {
{"value", "The date or date with time to round down to the first day of the ISO year.", {"Date", "Date32", "DateTime", "DateTime64"}}
};
FunctionDocumentation::ReturnedValue ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> result_type = ResultType::Date;
ToStartOfIntervalOverload overload = ToStartOfIntervalOverload::Default;
auto check_second_argument = [&]
{
const DataTypePtr & type_arg2 = arguments[1].type;
interval_type = checkAndGetDataType<DataTypeInterval>(type_arg2.g... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/DateTimeTransforms.h>
#include <Functions/FunctionDateOrDateTimeToDateTimeOrDateTime64.h>
namespace DB
{
using FunctionToStartOfMinute = FunctionDateOrDateTimeToDateTimeOrDateTime64<ToStartOfMinuteImpl>;
REGISTER_FUNCTION(ToStartOfMinute)
{
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/DateTimeTransforms.h>
#include <Functions/FunctionDateOrDateTimeToDateOrDate32.h>
namespace DB
{
using FunctionToStartOfMonth = FunctionDateOrDateTimeToDateOrDate32<ToStartOfMonthImpl>;
REGISTER_FUNCTION(ToStartOfMonth)
{
FunctionDocumenta... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/DateTimeTransforms.h>
#include <Functions/FunctionDateOrDateTimeToDateOrDate32.h>
namespace DB
{
using FunctionToStartOfQuarter = FunctionDateOrDateTimeToDateOrDate32<ToStartOfQuarterImpl>;
REGISTER_FUNCTION(ToStartOfQuarter)
{
FunctionDoc... | fim | ClickHouse/ClickHouse | cpp |
#include <Functions/FunctionFactory.h>
#include <Functions/DateTimeTransforms.h>
#include <Functions/FunctionDateOrDateTimeToSomething.h>
namespace DB
{
using FunctionToStartOfSecond = FunctionDateOrDateTimeToSomething<DataTypeDateTime64, ToStartOfSecondImpl>;
REGISTER_FUNCTION(ToStartOfSecond)
{
FunctionDocume... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>nctionDocumentation::Examples examples = {
{"Query without timezone", R"(
WITH toDateTime64('2020-01-01 10:20:30.999999999', 9) AS dt64
SELECT toStartOfNanosecond(dt64);
)", R"(
ββββββtoStartOfNanosecond(dt64)ββ
β 2020-01-01 10:20:30.999999999 β
βββββββββββββββββββββββββββββββββ
)"... | fim | ClickHouse/ClickHouse | cpp |
#include <Functions/FunctionFactory.h>
#include <Functions/DateTimeTransforms.h>
#include <Functions/FunctionDateOrDateTimeToDateTimeOrDateTime64.h>
namespace DB
{
using FunctionToStartOfTenMinutes = FunctionDateOrDateTimeToDateTimeOrDateTime64<ToStartOfTenMinutesImpl>;
REGISTER_FUNCTION(ToStartOfTenMinutes)
{
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>32", "DateTime", "DateTime64"}}
};
FunctionDocumentation::ReturnedValue returned_value = {"Returns the first day of the year for the given date/time", {"Date"}};
FunctionDocumentation::Examples examples = {
{"Round down to the first day of the year", R"(
SELECT toStartOfYear(toDateTime... | fim | ClickHouse/ClickHouse | cpp |
#include <Columns/ColumnFixedString.h>
#include <Columns/ColumnString.h>
#include <DataTypes/DataTypeFixedString.h>
#include <DataTypes/DataTypeString.h>
#include <Functions/FunctionFactory.h>
namespace DB
{
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
extern const int LOGICAL_ERROR;
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ed result is an offset to a fixed point in time, currently `1970-01-02`,
but the exact point in time is an implementation detail which may change in future.
`toTime` should therefore not be used standalone.
The main purpose of the function is to calculate the time difference between two dates or dates wi... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>REGISTER_FUNCTION(ToTimeZone)
{
FunctionDocumentation::Description description = R"(
Converts a `DateTime` or `DateTime64` to the specified time zone.
The internal value (number of unix seconds) of the data doesn't change.
Only the value's time zone attribute and the value's string representation chan... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> {description, syntax, arguments, {}, returned_value, examples, introduced_in, category};
factory.registerFunction<FunctionToTypeName>(documentation);
}
}
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/IFunction.h>
#include <Core/Field.h>
#include <Core/Settings.h>
#include... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionUnixTimestamp64.h>
#include <Functions/FunctionFactory.h>
namespace DB
{
REGISTER_FUNCTION(ToUnixTimestamp64Micro)
{
/// toUnixTimestamp64Micro documentation
FunctionDocumentation::Description description = R"(
Converts a [`DateTime64`](/sql-reference/data-types/datet... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionUnixTimestamp64.h>
#include <Functions/FunctionFactory.h>
namespace DB
{
REGISTER_FUNCTION(ToUnixTimestamp64Milli)
{
/// toUnixTimestamp64Milli documentation
FunctionDocumentation::Description description = R"(
Converts a [`DateTime64`](/sql-reference/data-types/datet... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ecision.
The input value is scaled up or down appropriately depending on its precision.
:::note
The output value is relative to UTC, not to the timezone of the input value.
:::
)";
FunctionDocumentation::Syntax syntax = "toUnixTimestamp64Nano(value)";
FunctionDocumentation::Arguments argument... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionUnixTimestamp64.h>
#include <Functions/FunctionFactory.h>
namespace DB
{
REGISTER_FUNCTION(ToUnixTimestamp64Second)
{
/// toUnixTimestamp64Second documentation
FunctionDocumentation::Description description = R"(
Converts a [`DateTime64`](/sql-reference/data-types/dat... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <DataTypes/DataTypeString.h>
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionStringToString.h>
#include <IO/WriteBufferFromVector.h>
#include <IO/WriteHelpers.h>
#include <Poco/UTF8Encoding.h>
#include <string_view>
#include <base/simd.h>
#ifdef __SSE2__
# include <emmint... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/DateTimeTrans<|fim_suffix|>ion::IntroducedIn introduced_in = {1, 1};
FunctionDocumentation::Category category = FunctionDocumentation::Category::DateAndTime;
FunctionDocumentation documentation = {description, syntax, arguments, {}, return... | fim | ClickHouse/ClickHouse | cpp |
#include <Functions/FunctionFactory.h>
#include <Functions/DateTimeTransforms.h>
#include <Functions/FunctionDateOrDateTimeToSomething.h>
#include <DataTypes/DataTypesNumber.h>
namespace DB
{
using FunctionToYYYYMMDD = FunctionDateOrDateTimeToSomething<DataTypeUInt32, ToYYYYMMDDImpl>;
REGISTER_FUNCTION(ToYYYYMMDD)
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/Function<|fim_suffix|>
{
using FunctionToYYYYMMDDhhmmss = FunctionDateOrDateTimeToSomething<DataTypeUInt64, ToYYYYMMDDhhmmssImpl>;
REGISTER_FUNCTION(ToYYYYMMDDhhmmss)
{
FunctionDocumentation::Description description = R"(
Converts a date or date with time to a `UInt64` number con... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ime('2023-04-21 10:20:30'))
)",
R"(
ββtoYear(toDateTime('2023-04-21 10:20:30'))ββ
β 2023 β
βββββββββββββββββββββββββββββββββββββββββββββ
)"
}
};
FunctionDocumentation::IntroducedIn introduced_in = {1, 1};
FunctionDocumentation::C... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Common/FunctionDocumentation.h>
#include <Functions/DateTimeTransforms.h>
#include <Functions/FunctionDateOrDateTimeToSomething.h>
#include <Functions/FunctionFactory.h>
namespace DB
{
namespace
{
/// Internal helper used by the `EXTRACT(CENTURY|DECADE|MILLENNIUM FROM ...)`
/// lowering. Thos... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>on<FunctionToYearNumSinceEpoch>({description, syntax, arguments, {}, returned_value, examples, introduced_in, category});
}
}
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/DateTimeTransforms.h>
#include <Functions/FunctionDateOrDateTimeToSomething.h>
#include <DataTypes/DataTyp... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Core/Field.h>
#include <DataTypes/DataTypeDate.h>
#include <Functions/FunctionFactory.h>
#include <Functions/IFunction.h>
#include <Columns/ColumnConst.h>
#include <Common/DateLUT.h>
#include <Common/DateLUTImpl.h>
namespace DB
{
namespace
{
class ExecutableFunctionToday final : public IExecu... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/QueryTokenizationImpl.h>
#include <Parsers/Lexer.h>
namespace DB
{
namespace
{
struct T<|fim_suffix|>Token();
if (token.isEnd())
break;
data_begin.push_back(token.begin - begin);
data_end.pu... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>card characters) and applies tokenizer-specific
rules to extract meaningful tokens for pattern matching.
It supports the same argument sets as the `tokens` function; additional
arguments after `tokenizer` are interpreted according to the selected
tokenizer (for example, `n` for `ngrams`, `separators` for... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <mutex>
#include <base/bit_cast.h>
#include <Columns/ColumnArray.h>
#include <Columns/ColumnConst.h>
#include <Columns/ColumnDecimal.h>
#include <Columns/ColumnString.h>
#include <Columns/ColumnNullable.h>
#include <Common/SipHash.h>
#include <Core/DecimalFunctions.h>
#include <DataTypes/DataTyp... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Columns/ColumnConst.h>
#include <Columns/ColumnFixedString.h>
#include <Columns/ColumnString.h>
#include <DataTypes/DataTypeFixedString.h>
#include <DataTypes/DataTypeString.h>
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionHelpers.h>
#include <Common/HashTable/HashMap.h>
#in... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#if 0
#include <Functions/IFunction.h>
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionHelpers.h>
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypesNumber.h>
#include <Columns/ColumnString.h>
#include <Interpreters/Context.h>
#include <base/scope_guard.h>
#include <Com... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Columns/ColumnString.h>
#include <DataTypes/DataTypeString.h>
#include <Columns/ColumnFixedString.h>
#include <Columns/IColumn.h>
#include <Functions/IFunction.h>
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionHelpers.h>
#include <base/find_symbols.h>
#include <array>
names... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionBase32Conversion.h>
#include <Functions/FunctionFactory.h>
namespace DB
{
namespace
{
struct NameTryBase32Decode
{
static constexpr auto name = "tryBase32Decode";
};
using TryBase32DecodeImpl = BaseXXDecod<|fim_suffix|>2Decode('IVXGG33EMVSA====');",
R"(
ββtryBase3... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>eric decoder is used.", {"UInt8, UInt16, UInt32, or UInt64"}}
};
FunctionDocumentation::ReturnedValue returned_value = {"Returns a string containing the decoded value of the argument.", {"String"}};
FunctionDocumentation::Examples examples = {
{
"Usage example",
"SELECT try... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>3VzZQ==')",
R"(
ββtryBase64Decode('Y2xpY2tob3VzZQ==')ββ
β clickhouse β
βββββββββββββββββββββββββββββββββββββββ
)"
}
};
FunctionDocumentation::IntroducedIn introduced_in = {18, 16};
FunctionDocumentation::Category category = FunctionDocumentation::Ca... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>)"
}
};
FunctionDocumentation::IntroducedIn introduced_in = {18, 16};
FunctionDocumentation::Category category = FunctionDocumentation::Category::String;
FunctionDocumentation documentation = {description, syntax, arguments, {}, returned_value, examples, introduced_in, category};
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>umentation::Examples examples = {
{
"Create table and insert data",
R"(
-- Let's create a table where user_id is the unique user id, encrypted is an encrypted string field, iv is an initial vector for decrypt/encrypt.
-- Assume that users know their id and the key to decryp... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>if their names are unique and can be treated as unquoted identifiers, otherwise a Tuple(T1, T2, ...) is returned. There is no cost to execute the function.
Tuples are normally used as intermediate values for an argument of IN operators, or for creating a list of formal parameters of lambda functions. Tupl... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>.column->convertToFullColumnIfConst();
}
return ColumnTuple::create(tuple_columns);
}
};
}
<|fim_prefix|>#pragma once
#include <Functions/IFunction.h>
#include <Columns/ColumnConst.h>
#include <Columns/ColumnTuple.h>
#include <DataTypes/DataTypeTuple.h>
#include <Functions/FunctionF... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>roduced_in, category};
factory.registerFunction<FunctionTupleConcat>(documentation);
}
}
<|fim_prefix|>#include <Columns/ColumnTuple.h>
#include <DataTypes/DataTypeTuple.h>
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionHelpers.h>
#include <Functions/IFunction.h>
#include <base/... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> return index;
if (argument_size == 2)
throw Exception(
ErrorCodes::BAD_ARGUMENTS, "Tuple doesn't have element with name '{}'", name_col->getValue<String>());
return std::nullopt;
}
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_AR... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Columns/ColumnTuple.h>
#include <DataTypes/DataTypeTuple.h>
#include <DataTypes/DataTypesNumber.h>
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionHelpers.h>
#include <Functions/ITupleFunction.h>
#include <Functions/castTypeToEither.h>
namespace DB
{
namespace ErrorCodes
{
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ISTER_FUNCTION(TupleNames)
{
factory.registerFunction<TupleNamesOverloadResolver>(FunctionDocumentation{
.description = R"(
Converts a tuple into an array of column names. For a tuple in the form `Tuple(a T, b T, ...)`, it returns an array of strings representing the named columns of the tuple... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>urrent_offset);
}
Columns tuple_columns = { std::move(keys_column), std::move(values_column) };
auto tuple_column = ColumnTuple::create(std::move(tuple_columns));
return ColumnArray::create(std::move(tuple_column), std::move(offsets));
}
};
}
REGISTER_FUNCTION(TupleT... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>house')",
R"(
ββupper('clickhouse')ββ
β CLICKHOUSE β
βββββββββββββββββββββββ
)"
}
};
FunctionDocumentation::IntroducedIn introduced_in = {1, 1};
FunctionDocumentation::Category category = FunctionDocumentation::Category::String;
FunctionDocumentation documentat... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include "config.h"
#if USE_ICU
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionStringToString.h>
#include <Functions/LowerUpperUTF8Impl.h>
namespace DB
{
namespace
{
struct NameUpperUTF8
{
static constexpr auto name = "upperUTF8";
};
using FunctionUpperUTF8 = FunctionStringToS... | fim | ClickHouse/ClickHouse | cpp |
#include <DataTypes/DataTypesNumber.h>
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionHelpers.h>
#include <Columns/ColumnsNumber.h>
#include <Columns/ColumnArray.h>
#include <Core/ColumnWithTypeAndName.h>
namespace DB
{
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
exte... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββ
)"
}
};
FunctionDocumentation::IntroducedIn introduced_in = {25, 2};
FunctionDocumentation::Category category = FunctionDocumentation::Category::Other;
FunctionDocumentation documentation = {description, syntax, ... | fim | ClickHouse/ClickHouse | cpp |
#include <Functions/IFunction.h>
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionHelpers.h>
#include <DataTypes/IDataType.h>
#include <DataTypes/DataTypeVariant.h>
#include <DataTypes/DataTypeEnum.h>
#include <Columns/ColumnVariant.h>
#include <Columns/ColumnVector.h>
#include <Columns/ColumnsNumber.... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/IFunction.h>
#include <Functions/FunctionFactory.h>
#include <DataTypes/DataTypesNumber.h>
#include <Formats/FormatSettings.h>
#include <Columns/ColumnsNumber.h>
#include <IO/Write<|fim_suffix|>
)"
}
};
FunctionDocumentation::IntroducedIn introduced_in = {1, 1};
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/FunctionsVisitParam.h>
#include <Functions/FunctionsStringSearch.h>
namespace DB
{
struct ExtractBool
{
using ResultType = UInt8;
static UInt8 extract(const UInt8 * begin, const UInt8 * end)
{
return begin + 4 <= end && 0 =... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/FunctionsVisitParam.h>
#include <Functions/F<|fim_suffix|>TE TABLE jsons
(
`json` String
)
ENGINE = MergeTree
ORDER BY tuple();
INSERT INTO jsons VALUES ('{"foo":"-4e3"}');
INSERT INTO jsons VALUES ('{"foo":-3.4}');
INSERT INTO jsons VALUES (... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/FunctionsVisitParam.h>
#include <Functions/FunctionsStringSearch.h>
namespace DB
{
struct NameSimpleJSONExtractInt { static constexpr auto name = "simpleJSONExtractInt"; };
using FunctionSimpleJSONExtractInt = FunctionsStringSearch<ExtractParam... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/FunctionsVisitParam.h>
#include <Functions/FunctionsStringSearchToString.h>
namespace DB
{
struct ExtractRaw
{
using ExpectChars = PODArrayWithStackMemory<char, 64>;
static void extract(const UInt8 * pos, const UInt8 * end, ColumnStrin... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ns VALUES ('{"foo":"\\u263"}');
INSERT INTO jsons VALUES ('{"foo":"\\u263a"}');
INSERT INTO jsons VALUES ('{"foo":"hello}');
SELECT simpleJSONExtractString(json, 'foo') FROM jsons ORDER BY json;
)",
R"(
\n\0
βΊ
)"
}
};
FunctionDocumentation::IntroducedIn introduced_in... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Functions/FunctionFactory.h>
#include <Functions/FunctionsVisitParam.h>
#include <Functions/FunctionsStringSearch.h>
namespace DB
{
struct NameSimpleJSONExtractUInt { static constexpr auto name = "simpleJSONExtractUInt"; };
using FunctionSimpleJSONExtractUInt = FunctionsStringSearch<ExtractPa... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> )",
R"(
1
0
)"
}
};
FunctionDocumentation::IntroducedIn introduced_in = {21, 4};
FunctionDocumentation::Category category = FunctionDocumentation::Category::JSON;
FunctionDocumentation documentation = {description, syntax, arguments, {}, returned_value, example,... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> arguments) const override
{
FunctionArgumentDescriptors mandatory_args{
{"operand", isNativeNumber, nullptr, "native numeric"},
{"min_range", isNativeNumber, nullptr, "native numeric"},
{"max_range", isNativeNumber, nullptr, "native numeric"},
{... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Columns/ColumnString.h>
#include <DataTypes/DataTypeString.h>
#include <Functions/FunctionFactory.h>
#include <Functions/geometryConverters.h>
#include <Common/WKB.h>
#include <memory>
#include <string>
namespace DB
{
namespace ErrorCodes
{
extern const int BAD_ARGUMENTS;
}
namespace
{
clas... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <DataTypes/DataTypeString.h>
#include <Functions/FunctionFactory.h>
#include <Functions/geometryConverters.h>
#include <Columns/ColumnString.h>
#include <string>
#include <memory>
namespace DB
{
namespace
{
class FunctionWKT final : public IFunction
{
public:
static inline const char * na... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>β
)"}
};
FunctionDocumentation::IntroducedIn introduced_in = {1, 1};
FunctionDocumentation::Category category = FunctionDocumentation::Category::DateAndTime;
FunctionDocumentation documentation = {description, syntax, arguments, {}, returned_value, examples, introduced_in, category... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>at64 z = -boost::math::quantile(nd, (1.0 - confidence_level) / 2.0);
Float64 dist = z * se;
Float64 ci_low = d - dist;
Float64 ci_high = d + dist;
insert_values_into_result(zstat, pvalue, ci_low, ci_high);
}
return ColumnTuple::create(
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <IO/AIO.h>
#include <Common/ErrnoException.h>
namespace DB::ErrorCodes
{
extern const int CANNOT_IOSETUP;
}
#if defined(OS_LINUX)
# include <Common/Exception.h>
# include <sys/syscall.h>
# include <unistd.h>
# include <utility>
/** Small wrappers for asynchronous I/O.
*/
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <boost/noncopyable.hpp>
#if defined(OS_LINUX)
/// https://stackoverflow.com/questions/20759750/resolving-redefinition-of-timespec-in-time-h
# define timespec linux_timespec
# define timeval linux_timeval
# define itimerspec linux_itimerspec
# define sigset_t linux_sigs... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <IO/Archives/ArchiveUtils.h>
#include <string_view>
#include <array>
namespace DB
{
namespace
{
using namespace std::literals;
constexpr std::array tar_extensions{".tar"sv, ".tar.gz"sv, ".tgz"sv, ".tar.zst"sv, ".tzst"sv, ".tar.xz"sv, ".tar.bz2"sv, ".tar.lzma"sv};
constexpr std::array zip_exte... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include "config.h"
#if USE_LIBARCHIVE
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreserved-macro-identifier"
#include <archive.h>
#include <archive_entry.h>
#endif
#include <optional>
#include <string_view>
#include <string>
namespace DB
{
bo<|fim_suffix|>tring, ... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <boost/noncopyable.hpp>
#include <base/types.h>
#include <Core/Types.h>
#include <functional>
#include <memory>
#include <Poco/Timestamp.h>
namespace DB
{
class ReadBuffer;
class ReadBufferFromFileBase;
class SeekableReadBuffer;
/// Interface for reading an archive.
class IArchiv... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <boost/noncopyable.hpp>
#include <base/type<|fim_suffix|>const String & filename, size_t size) = 0;
/// Returns true if there is an active instance of WriteBuffer returned by writeFile().
/// This function should be used mostly for debugging purposes.
virtual bool isWri... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <IO/Archives/ArchiveUtils.h>
#include <IO/Archives/LibArchiveReader.h>
#include <IO/ReadBufferFromFileBase.h>
#include <Common/quoteString.h>
#include <Common/scope_guard_safe.h>
namespace DB
{
#if USE_LIBARCHIVE
namespace ErrorCodes
{
extern const int CANNOT_UNPACK_ARCHIVE;
extern const int ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>tring path_to_archive, const ReadArchiveFunction & archive_read_function, size_t archive_size = 0)
: LibArchiveReader("7z", /*lock_on_reading_=*/false, std::move(path_to_archive), archive_read_function, archive_size)
{
}
};
#endif
}
<|fim_prefix|>#pragma once
#include <mutex>
#include <... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <IO/Archives/LibArchiveWriter.h>
#include <filesystem>
#include <IO/WriteBufferFromFileBase.h>
#include <Common/quoteString.h>
#include <Common/scope_guard_safe.h>
#include <mutex>
#if USE_LIBARCHIVE
// this implemation follows the ZipArchiveWriter implemation as closely as possible.
namespa... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>)` should be destroyed before next call of `writeFile()`.
std::unique_ptr<WriteBufferFromFileBase> writeFile(const String & filename) override;
/// LibArchive needs to know the size of the file being written. If the file size is not
/// passed in the archive writer tries to infer the size by l... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <IO/Archives/TarArchiveWriter.h>
#if USE_LIBARCHIVE
namespace DB
{
namespace ErrorCodes
{
extern const int NOT_IMPLEMENTED;
extern const int CANNOT_PACK_ARCHIVE;
}
void TarArchiveWriter::setCompression(const String & compression_method_, int compression_level<|fim_suffix|>chive.ends_with(".tar.b... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include "config.h"
#if USE_LIBARCHIVE
# include <IO/Archives/LibArchiveWriter.h>
namespace DB
{
using namespace std::literals;
class TarArchiveWriter : public LibArchiveWriter
{
public:
explicit TarArchiveWriter(
const String & path_to_archive_,
std::unique_ptr<Wri... | fim | ClickHouse/ClickHouse | c |
#include <IO/Archives/ZipArchiveReader.h>
#if USE_MINIZIP
#include <IO/Archives/ZipArchiveWriter.h>
#include <IO/ReadBufferFromFileBase.h>
#include <Common/quoteString.h>
#include <base/errnoToString.h>
#include <unzip.h>
#include <zip.h>
#include <mz.h>
namespace DB
{
namespace ErrorCodes
{
extern const int CA... | fim | ClickHouse/ClickHouse | cpp |
#pragma once
#include "config.h"
#if USE_MINIZIP
#include <IO/Archives/IArchiveReader.h>
#include <Common/VectorWithMemoryTracking.h>
#include <mutex>
namespace DB
{
class ReadBuffer;
class ReadBufferFromFileBase;
class SeekableReadBuffer;
/// Implementation of IArchiveReader for reading zip archives.
class ZipArc... | fim | ClickHouse/ClickHouse | c |
#include <IO/Archives/ZipArchiveWriter.h>
#if USE_MINIZIP
#include <Common/StackTrace.h>
#include <Common/logger_useful.h>
#include <Common/quoteString.h>
#include <IO/WriteBufferFromFileBase.h>
#include <base/errnoToString.h>
#include <Poco/Logger.h>
#include <boost/algorithm/string/predicate.hpp>
#include <zip.h>... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>eflate".
int compression_level TSA_GUARDED_BY(mutex) = kDefaultCompressionLevel;
String password TSA_GUARDED_BY(mutex);
ZipHandle zip_handle TSA_GUARDED_BY(mutex) = nullptr;
bool is_writing_file TSA_GUARDED_BY(mutex) = false;
bool finalized TSA_GUARDED_BY(mutex) = false;
mutable st... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>archive,
[[maybe_unused]] const std::function<std::unique_ptr<SeekableReadBuffer>()> & archive_read_function,
[[maybe_unused]] size_t archive_size)
{
if (hasSupportedZipExtension(path_to_archive))
{
#if USE_MINIZIP
return std::make_shared<ZipArchiveReader>(path_to_archive, archive_... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>adBuffer>()> & archive_read_function,
size_t archive_size);
}
<|fim_prefix|>#pragma once
#include <base/types.h>
#include <functional>
#include <memory>
namespace DB
{
class IArchiveReader;
class SeekableReadBuffer;
/// Starts reading a specified archive in the local filesystem.
std::shared_ptr<I... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <IO/Archives/ArchiveUtils.h>
#include <IO/Archives/TarArchiveWriter.h>
#include <IO/Archives/ZipArchiveWriter.h>
#include <IO/Archives/createArchiveWriter.h>
#include <IO/WriteBuffer.h>
#include <Common/Exception.h>
namespace DB
{
namespace ErrorCodes
{
extern const int CANNOT_PACK_ARCHIVE;
ext... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>lesystem.
/// If `archive_write_buffer` is null, the archive is written to the local filesystem at `path_to_archive`.
/// Otherwise, `path_to_archive` is used only to determine the archive type.
std::shared_ptr<IArchiveWriter> createArchiveWriter(
const String & path_to_archive,
std::unique_ptr<Wr... | fim | ClickHouse/ClickHouse | c |
#include <IO/Archives/hasRegisteredArchiveFileExtension.h>
#include <algorithm>
#include <array>
namespace DB
{
bool hasRegisteredArchiveFileExtension(const String & path)
{
using namespace std::literals;
static constexpr std::array archive_extensions{
".zip"sv, ".zipx"sv, ".tar"sv, ".tar.gz"sv, ".tg... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <base/types.h>
namespace DB
{
/// Returns true if a specified path has one of the registered file extensions<|fim_suffix|>rchive.
bool hasRegisteredArchiveFileExtension(const String & path);
}
<|fim_middle|> for an a<|endoftext|> | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <iostream>
#include <IO/Ask.h>
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
namespace DB
{
bool ask(std::string question, ReadBuffer & in, WriteBuffer & out)
{
while (true)
{
std::string answer;
writeText(question, out);
out.next();
readStrin... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> The one with ReadBuffer/WriteBuffer is for Client application while
/// the one with std::cin/std::cout is for helper scripts mostly.
[[nodiscard]] bool ask(std::string question, ReadBuffer & in, WriteBuffer & out);
[[nodiscard]] bool ask(std::string question);
}
<|fim_prefix|>#pragma once
#include <str... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <Columns/ColumnArray.h>
#include <Columns/ColumnLowCardinality.h>
#include <Columns/ColumnMap.h>
#include <Columns/ColumnTuple.h>
#include <Columns/ColumnsNumber.h>
#include <IO/AsyncReadCount<|fim_suffix|>_tasks", max_parallel_read_tasks.load(std::memory_order_relaxed));
load_if_not_empty("m... | fim | ClickHouse/ClickHouse | cpp |
#pragma once
#include <atomic>
#include <cstddef>
#include <memory>
namespace DB
{
class IColumn;
/// Metrics for asynchronous reading feature.
///
/// All fields are atomic and updated with relaxed memory ordering: the values
/// are only used for monitoring (dumped into `system.query_log` via
/// `dumpToMapColumn... | fim | ClickHouse/ClickHouse | c |
#include <IO/AsynchronousReadBufferFromFile.h>
namespace DB
{
AsynchronousReadBufferFromFileWithDescriptorsCache::~AsynchronousReadBufferFromFileWithDescriptorsCache()
{
/// Must wait for events in flight before potentially closing the file by destroying OpenedFilePtr.
finalize();
}
}
<|endoftext|> | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>mory, alignment, file_size_, throttler_, prefetches_log_)
, file_name(file_name_)
{
file = OpenedFileCache::instance().get(file_name, flags);
fd = file->getFD();
}
~AsynchronousReadBufferFromFileWithDescriptorsCache() override;
std::string getFileName() const over... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>throttler)
throttler->throttle(result.size);
if (bytes_read)
{
/// Adjust the working buffer so that it ignores `offset` bytes.
working_buffer = Buffer(result.buf + result.offset, result.buf + result.size);
pos = working_buffer.begin();
}
return bytes_read... | fim | ClickHouse/ClickHouse | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.