text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
#pragma once
#include <cstdint>
namespace DB
{
enum class StreamingHandleErrorMode : uint8_t
{
DEFAULT = 0, // Ignore errors with threshold.
STREAM, // Put errors to stream in the virtual column named ``_error.
DEAD_LETTER_QUEUE // Put errors in the system table
};
}
<|endoftext|> | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <Core/Types_fwd.h>
namespace D<|fim_suffix|>cimal32)
TYPEID_MAP(Decimal64)
TYPEID_MAP(Decimal128)
TYPEID_MAP(Decimal256)
TYPEID_MAP(DateTime64)
TYPEID_MAP(Time64)
TYPEID_MAP(String)
struct Array;
TYPEID_MAP(Array)
struct Map;
TYPEID_MAP(Map)
struct Object;
TYPEID_MAP(Object)
#... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <Core/TypeId.h>
#include <cstdint>
#include <string>
#include <vector>
#include <unordered_set>
#include <base/strong_typedef.h>
#include <base/Decimal.h>
#include <base/defines.h>
#include <base/UUID.h>
#include <base/IPv4andIPv6.h>
namespace DB
{
/// Data types for representing... | fim | ClickHouse/ClickHouse | c |
#pragma once
#include <cstdint>
#include <vector>
#include <unordered_set>
#include <base/strong_typedef.h>
#include <base/defines.h>
#include <base/types.h>
#include <base/Decimal_fwd.h>
namespace wide
{
template <size_t Bits, typename Signed>
class integer;
}
using Int128 = wide::integer<128, signed>;
using UInt... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>fffffull) | 0x8000000000000000ull;
return uuid;
}
}
}
<|fim_prefix|>#include <Core/UUID.h>
#include <Common/thread_local_rng.h>
#include <Common/SipHash.h>
namespace DB
{
namespace UUIDHelpers
{
UUID generateV4()
{
UUID uuid;
getHighBytes(uuid) = (thread_local_rng(... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <Core/Types.h>
/**
* Implementation Details
* ^^^^^^^^^^^^^^^^^^^^^^
* The underlying implementation for a UUID has it represented as a 128-bit unsigned integer. Underlying this, a wide
* integer with a 64-bit unsigned integer as its base is utilized. This wide integer can be i... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>pe
struct ValueWithType
{
llvm::Value * value = nullptr;
DataTypePtr type;
ValueWithType() = default;
ValueWithType(llvm::Value * value_, DataTypePtr type_)
: value(value_)
, type(std::move(type_))
{}
};
}
<|fim_prefix|>#pragma once
namespace llvm
{
clas<|fim_mid... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <vector>
#include <Core/ValueWithTy<|fim_suffix|>
namespace DB
{
using ValuesWithType = std::vector<ValueWithType>;
}
<|fim_middle|>pe.h><|endoftext|> | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>RRECT_DATA, "Broken YtSaurus schema json. Missing `strict` field in attributes.");
bool is_strict = attributes->getValue<bool>("strict");
// Doesn't make sense to continue, schema isn't strict.
if (!is_strict)
return {is_strict, {}};
if (!schema_json->has("$value"))
{
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>= 0;
constexpr static String LOCKS_STORAGE_CYPRESS_PATH = "//sys/locks";
};
using YTsaurusClientPtr = std::shared_ptr<YTsaurusClient>;
class YTsaurusTableLock
{
public:
YTsaurusTableLock(YTsaurusClientPtr client_, const String& cypress_path_, size_t transaction_timeout_ms);
String getNodePat... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#if USE_YTSAURUS
#include <Core/Types.h>
#include <fmt/format.h>
#include <Poco/Net/HTTPRequest.h>
namespace DB
{
struct QueryParameter
{
String name;
String value;
};
using QueryParameters = std::vector<QueryParameter>;
struct IYTsaurusQuery
{
virtual String getQueryName()... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <utility>
#include <Core/Types.h>
#include <DataTypes/DataTypeInterval.h>
namespace DB
{
template <typename T, typename U>
struct TypePair
{
using LeftType = T;
using RightType = U;
};
template <typename T, bool _int, bool _float, bool _decimal, bool _datetime, typenam... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>ot " << n << " fields (" << static_cast<double>(n) * sizeof(array[0]) / 1000000.0 << " MB) in " << watch.elapsedSeconds() << " sec., "
<< static_cast<double>(n) / watch.elapsedSeconds() << " elem/sec. (" << static_cast<double>(n) * sizeof(array[0]) / watch.elapsedSeconds() / 1000000 <<... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>/// Example taken from https://github.com/googleapis/google-cloud-cpp/tree/main/google/cloud/kms#quickstart
#include <google/cloud/kms/v1/key_management_client.h>
#include <google/cloud/location.h>
#include <iostream>
#include <Examples/clickhouse_examples.h>
int mainEntryExampleGcloudKms(int argc, char... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>Object(bucket_name, "quickstart.txt");
if (!reader)
{
std::cerr << "Error reading object: " << reader.status() << "\n";
return 1;
}
std::string contents{std::istreambuf_iterator<char>{reader}, {}};
std::cout << contents << "\n";
return 0;
}
<|fim_prefix|>/// Examp... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> " sec, "
<< static_cast<double>(vec.size()) / watch.elapsedSeconds() << " rows/sec., "
<< static_cast<double>(in.count()) / watch.elapsedSeconds() / 1000000 << " MB/sec."
<< std::endl;
size_t i = 0;
for (auto it = set.begin(); i < elems_show && it != s... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <base/StringViewHash.h>
#include <IO/ReadBufferFromFileDescriptor.h>
#include <IO/WriteBufferFromFileDescriptor.h>
#include <IO/Operators.h>
#include <Examples/clickhouse_examples.h>
/** Calculates StringViewHash from stdin. For debugging.
*/
int mainEntryExampleStringRefHash(int, char **)
{... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>in(data, size);
DB::NamesAndTypesList res;
res.readText(in);
}
catch (...)
{
// Ok
}
return 0;
}
<|fim_prefix|>#include <Core/NamesAndTypes.h>
#include <IO/ReadBufferFromMemory.h>
extern "C" int LLVMFuzzerTestOneInput(const uin<|fim_middle|>t8_t * data, size_t... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>sk = pool->createTask(StorageID::createEmpty(), "test", [&] {});
delayed_task = pool->createTask(StorageID::createEmpty(), "delayed_test", [&] {});
pool->join();
}
ASSERT_EQ(task->activateAndSchedule(), false);
ASSERT_EQ(delayed_task->activate(), true); /// does not requires ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> 187618332,
123
}
},
{
"Negative timestamp 1969-12-31 23:59:59.123 UTC",
DateTime64(-877),
3,
{
0,
-877
}
},
{
"Positive timestamp 1... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <gtest/gtest.h>
#include <Core/AccurateComparison.h>
using namespace DB;
GTEST_TEST(AccurateCompa<|fim_suffix|>_TRUE(accurate::greaterOp(std::numeric_limits<Float64>::infinity(), -1000));
ASSERT_TRUE(accurate::lessOp(1, 1e100));
ASSERT_TRUE(accurate::lessOp(-1, 1e100));
ASSERT_TRU... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <gtest/gtest.h>
#include <Core/Field.h>
using namespace DB;
GTEST_TEST(Field, FromBool)
{
{
Field f{false};
ASSERT_EQ(f.getType(), Field::Types::Bool);
ASSERT_EQ(f.safeGet<UInt64>(), 0);
ASSERT_EQ(f.safeGet<bool>(), false);
}
{
Field f{true};... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>), Field(String("Hello, World 2!"))})
}));
}
<|fim_prefix|>#include <gtest/gtest.h>
#include <Common/FieldBinaryEncoding.h>
#include <IO/WriteBufferFromString.h>
#include <IO/ReadBufferFromString.h>
using namespace DB;
namespace DB::ErrorCodes
{
extern const int UNSUPPORTED_METHOD;
}
static v... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>InsertPostgreSQLValue, WellFormedArraySucceeds)
{
auto nested_type = std::make_shared<DataTypeInt32>();
auto array_type = std::make_shared<DataTypeArray>(nested_type);
auto column = ColumnArray::create(ColumnInt32::create());
std::unordered_map<size_t, PostgreSQLArrayInfo> array_info;
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <gtest/gtest.h>
#include <base/types.h>
#include <type_traits>
#include <Core/MultiEnum.h>
namespace
{
enum class TestEnum : UInt8
{
// name represents which bit is going to be set
ZERO,
ONE,
TWO,
THREE,
FOUR,
FIVE
};
}
GTEST_TEST(MultiEnum, WithDefault)
{
Mult... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>SetInvalidString)
{
// Setting can be initialized with int value corresponding to (DECIMAL | DATETIME64)
SettingMySQLDataTypesSupport setting;
EXPECT_THROW(setting = String("FOOBAR"), Exception);
ASSERT_FALSE(setting.changed);
ASSERT_EQ(std::vector<MySQLDataTypesSupport>{}, setting.val... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma clang diagnostic ignored "-Wreserved-identifier"
#include <base/defines.h>
#include <base/errnoToString.h>
#include <Common/VectorWithMemoryTracking.h>
#include <Core/Settings.h>
#include <Daemon/BaseDaemon.h>
#include <Daemon/CrashWriter.h>
#include <sys/stat.h>
#include <sys/types.h>
#include ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>mmon/Config/ConfigProcessor.h>
#include <Common/MapWithMemoryTracking.h>
#include <Common/StatusFile.h>
#include <Loggers/Loggers.h>
class SignalListener;
/// \brief Base class for applications that can run as daemons.
///
/// \code
/// # Some possible command line options:
/// # --config-file, -C o... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|> writeChar('}', json);
};
writeCString(",\"trace\":[", json);
StackTrace::forEachFrame(frame_pointers, offset, size, add_frame, /* fatal= */ true);
writeChar(']', json);
}
writeChar('}', json);
json.next();
json.finalize();... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>OGICAL_ERRORs (if "send_logical_errors" is enabled)
/// to ClickHouse core developer team.
///
/// This feature can be enabled with "send_crash_reports.enabled" server setting.
///
/// It is possible to send those reports to your own endpoint
/// by overriding the "send_crash_reports.endpoint" setting.
cl... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <Daemon/GraphiteWriter.h>
#include <Daemon/BaseDaemon.h>
#include <Poco/Util/LayeredConfiguration.h>
#include <Poco/Util/Application.h>
#include <base/getFQDNOrHostName.h>
#include <mutex>
#include <iomanip>
GraphiteWriter::GraphiteWriter(const std::string & config_name, const std::string & su... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <string>
#include <time.h>
#include <Poco/Net/StreamSocket.h>
#include <Poco/Net/SocketStream.h>
#include <Poco/Util/Application.h>
#include <Common/VectorWithMemoryTracking.h>
#include <Common/logger_useful.h>
/// Writes to Graphite in the following format
/// path value timestam... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|> complete data aggregation.
For example, the following two queries return the same result:
```sql
SELECT uniq(UserID) FROM table
SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID)
```
## Usage Example {#usage-example}
See [AggregatingMergeTree](../../engines... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <AggregateFunctions/IAggregateFunction_fwd.h>
#include <Core/Field.h>
#include <DataTypes/IDataType.h>
namespace DB
{
/** Type - the state of the aggregate function.
* Type parameters is an aggregate function, the types of its arguments, and its parameters (for parametric aggre... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>y.
## Creating an Array {#creating-an-array}
You can use a function to create an array:
```sql
array(T)
```
You can also use `[]`.
```sql
[]
```
Example of creating an array:
```sql
SELECT array(1, 2) AS x, toTypeName(x)
```
```text
ββxββββββ¬βtoTypeName(array(1, 2))ββ
β [1,2] β Array(UInt8) ... | fim | ClickHouse/ClickHouse | cpp |
#pragma once
#include <DataTypes/IDataType.h>
#include <DataTypes/Serializations/SerializationArray.h>
#include <Columns/ColumnArray.h>
namespace DB
{
class DataTypeArray final : public IDataType
{
private:
/// The type of array elements.
DataTypePtr nested;
public:
using FieldType = Array;
using ... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <memory>
#include <cstddef>
#include <Core/Types_fwd.h>
#include <DataTypes/Serializations/ISerialization.h>
namespace DB<|fim_suffix|>ata type customization
*/
struct DataTypeCustomDesc
{
DataTypeCustomNamePtr name;
SerializationPtr serialization;
explicit DataTypeCu... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|> });
// Custom type for simple line which consists from several segments.
factory.registerSimpleDataTypeCustom("LineString", []
{
return std::make_pair(DataTypeFactory::instance().get("Array(Point)"),
std::make_unique<DataTypeCustomDesc>(std::make_unique<DataTypeLineStrin... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTypes/DataTypeCustom.h>
namespace DB
{
class DataTypePointName : public DataTypeCustomFixedName
{
public:
DataTypePointName() : DataTypeCustomFixedName("Point") {}
};
class DataTypeLineStringName : public DataTypeCustomFixedName
{
public:
DataTypeLineStringName() : D... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>ggregatefunction.md)
type does.
This optimization can be applied to functions for which the following property
holds:
> the result of applying a function `f` to a row set `S1 UNION ALL S2` can
be obtained by applying `f` to parts of the row set separately, and then again
applying `f` to the results: `f(... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <AggregateFunctions/IAggregateFunction_fwd.h>
#include <Core/Field.h>
#include <DataTypes/DataTypeCustom.h>
names<|fim_suffix|>ggregateFunctionType(const AggregateFunctionPtr & function, const DataTypes & argument_types, const Array & parameters);
}
<|fim_middle|>pace DB
{
class... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <DataTypes/DataTypeDate.h>
#include <DataTypes/Serializations/SerializationDate.h>
#include <DataTypes/DataTyp<|fim_suffix|>ription = R"DOCS_MD(
A date. Stored in two bytes as the number of days since 1970-01-01 (unsigned). Allows storing values from just after the beginning of the Unix Epoch to ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTypes/DataTypeNumberBase.h>
namespace DB
{
class DataTypeDate final : public DataTypeNumberBase<UInt16>
{
public:
static constexpr auto family_name = "Date";
TypeIndex getTypeId() const override { return TypeIndex::Date; }
TypeIndex getColumnType() const overrid... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|> .related = {"Date", "DateTime"},
});
}
}
<|fim_prefix|>#include <DataTypes/DataTypeDate32.h>
#include <DataTypes/DataTypeFactory.h>
#include <DataTypes/Serializations/SerializationDate32.h>
#include <Common/DateLUT.h>
namespace DB
{
bool DataTypeDate32::equals(const IDataType & rhs) const
{
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>) const override { return TypeIndex::Int32; }
const char * getFamilyName() const override { return family_name; }
Field getDefault() const override;
bool canBeUsedAsVersion() const override { return true; }
bool canBeInsideNullable() const override { return true; }
bool equals(const... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/Serializations/SerializationDateTime.h>
#include <Common/DateLUT.h>
#include <Common/DateLUTImpl.h>
#include <IO/Operators.h>
#include <IO/WriteBufferFromString.h>
namespace DB
{
DataTypeDateTime::DataTypeDateTime(std::string_view time_zone_n... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <Core/Types.h>
#include <DataTypes/DataTypeNumberBase.h>
#include <DataTypes/TimezoneMixin.h>
namespace DB
{
/** DateTime stores time as unix timestamp.
* The value itself is independent of time zone.
*
* In binary format it is represented as unix timestamp.
* In text form... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <Common/DateLUT.h>
#include <Common/SipHash.h>
#include <DataTypes/DataTypeDateTime64.h>
#include <DataTypes/Serializations/SerializationDateTime64.h>
#include <IO/Operators.h>
#include <IO/WriteBufferFromString.h>
#include <string>
namespace DB
{
namespace ErrorCodes
{
extern const int A... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>erride { return family_name; }
std::string doGetName() const override;
TypeIndex getTypeId() const override { return type_id; }
void updateHashImpl(SipHash & hash) const override;
bool equals(const IDataType & rhs) const override;
bool canBePromoted() const override { return false; }
... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <type_traits>
#include <Core/DecimalFunctions.h>
#include <Core/Settings.h>
#include <DataTypes/DataTypeDecimalBase.h>
#include <Interpreters/Context.h>
namespace DB
{
namespace Setting
{
extern const SettingsBool decimal_check_overflow;
}
namespace ErrorCodes
{
}
template <is_decimal T>
c... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <type_traits>
#i<|fim_suffix|> 1, DataTypeDecimalBase<Decimal256>::maxPrecision(), precision_value);
if (scale_value > precision_value)
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "Negative scales and scales larger than precision are not supported");
i... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|> β
βββββββ΄ββββββββββββββββββββββββββββββ
```
```sql
CREATE TABLE test_bool
(
`A` Int64,
`B` Bool
)
ENGINE = Memory;
INSERT INTO test_bool VALUES (1, true),(2,0);
SELECT * FROM test_bool;
ββAββ¬βBββββββ
β 1 β true β
β 2 β false β
βββββ΄ββββββββ
```
)DOCS_MD",
.syntax = "Bool",
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ble(UInt8) β
β 4 β 0 β Nullable(UInt8) β
ββββββββ΄βββββββ΄ββββββββββββββββββ
```
```sql
SELECT d, exp2(d) AS res, toTypeName(res) FROM test;
```
```sql
ββdβββββ¬ββresββ¬βtoTypeName(res)ββββ
β α΄Ία΅α΄Έα΄Έ β α΄Ία΅α΄Έα΄Έ β Nullable(Float64) β
β 1 β 2 β Nullable(Float64) β
β 2 β 4 β Nullable(Float64) β
β 3 ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ta(std::string_view subcolumn_name, const SubstreamData & data, size_t initial_array_level, bool throw_if_null) const override;
size_t getMaxDynamicTypes() const { return max_dynamic_types; }
void updateHashImpl(SipHash & hash) const override;
private:
SerializationPtr doGetSerialization(co... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|> do on the underlying numeric values.
Enum values cannot be compared with numbers. Enums can be compared to a constant string. If the string compared to is not a valid value for the Enum, an exception will be thrown. The IN operator is supported with the Enum on the left-hand side and a set of strings on... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <vector>
#include <DataTypes/IDataType.h>
#include <DataTypes/EnumValues.h>
#include <Columns/ColumnVector.h>
#include <Parsers/IAST_fwd.h>
namespace DB
{
class IDataTypeEnum : public IDataType
{
public:
virtual Field castToName(const Field & value_or_name) const = 0;
vir... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>es::LOGICAL_ERROR, "DataTypeFactory: the data type family name '{}' is not unique",
family_name);
if (case_sensitiveness == Case::Insensitive
&& !case_insensitive_data_types.emplace(family_name_lowercase, creator).second)
throw Exception(ErrorCodes::LOGICAL_ERROR, "DataTyp... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>dString(DataTypeFactory & factory);
void registerDataTypeEnum(DataTypeFactory & factory);
void registerDataTypeArray(DataTypeFactory & factory);
void registerDataTypeTuple(DataTypeFactory & factory);
void registerDataTypeQBit(DataTypeFactory & factory);
void registerDataTypeMap(DataTypeFactory & factory);... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <Columns/ColumnFixedString.h>
#include <|fim_suffix|>:"a\u0000"}
SELECT name
FROM FixedStringTable
WHERE name = 'a'
FORMAT JSONStringsEachRow
Query id: c32cec28-bb9e-4650-86ce-d74a1694d79e
{"name":"a\u0000"}
SELECT name
FROM FixedStringTable
WHERE name LIKE 'a'
FORMAT JSONStringsEachRow
0... | fim | ClickHouse/ClickHouse | cpp |
#pragma once
#include <DataTypes/IDataType.h>
constexpr size_t MAX_FIXEDSTRING_SIZE = 0xFFFFFF;
constexpr size_t MAX_FIXEDSTRING_SIZE_WITHOUT_SUSPICIOUS = 256;
namespace DB
{
class ColumnFixedString;
class DataTypeFixedString final : public IDataType
{
private:
size_t n;
public:
using ColumnType = ColumnF... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <DataTypes/DataTypeFunction.h>
#include <IO/WriteBufferFromString.h>
#include <IO/Operators.h>
#include <Common/SipHash.h>
namespace DB
{
std::string DataTypeFunction::doGetName() const
{
WriteBufferFromOwnString res;
res << "Function(";
if (argument_types.size() > 1)
res ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTypes/IDataTypeDummy.h>
namespace DB
{
/** Special data type, representing lambda expression.
*/
class DataTypeFunction final : public IDataTypeDummy
{
private:
DataTypes argument_types;
DataTypePtr return_type;
public:
static constexpr bool is_parametric = tr... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <DataTypes/DataTypeIPv4andIPv6.h>
#include <DataTypes/DataTypeFactory.h>
#include <DataTypes/Serializations/SerializationIPv4andIPv6.h>
namespace DB
{
void registerDataTypeIPv4andIPv6(DataTypeFactory & factory)
{
factory.registerSimpleDataType("IPv4", [] { return DataTypePtr(std::make_shar... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTypes/IDataType.h>
#include <Columns/ColumnVector.h>
#include <base/IPv4andIPv6.h>
#include <DataTypes/Serializations/SerializationIPv4andIPv6.h>
namespace DB
{
class DataTypeIPv4 final : public IDataType
{
public:
static constexpr bool is_parametric = false;
using ... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>lDay"},
});
factory.registerSimpleDataType("IntervalQuarter", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Quarter)); }, DataTypeFactory::Case::Sensitive,
Documentation{
.description = "Represents an interval of quarters; used as the result... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> "Interval"; }
TypeIndex getTypeId() const override { return TypeIndex::Interval; }
TypeIndex getColumnType() const override { return TypeIndex::Int64; }
bool equals(const IDataType & rhs) const override;
void updateHashImpl(SipHash & hash) const override;
bool isParametric() const o... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>rdinality_max_dictionary_size](../../operations/settings/settings.md#low_cardinality_max_dictionary_size)
- [low_cardinality_use_single_dictionary_for_part](../../operations/settings/settings.md#low_cardinality_use_single_dictionary_for_part)
- [low_cardinality_allow_in_native_format](../../operations/set... | fim | ClickHouse/ClickHouse | cpp |
#pragma once
#include <DataTypes/IDataType.h>
#include <Columns/IColumnUnique.h>
namespace DB
{
class DataTypeLowCardinality final : public IDataType
{
private:
DataTypePtr dictionary_type;
public:
explicit DataTypeLowCardinality(DataTypePtr dictionary_type_);
const DataTypePtr & getDictionaryType() ... | fim | ClickHouse/ClickHouse | c |
#include <Columns/ColumnArray.h>
#include <Columns/ColumnConst.h>
#include <Columns/ColumnFunction.h>
#include <Columns/ColumnLowCardinality.h>
#include <Columns/ColumnMap.h>
#include <Columns/ColumnNullable.h>
#include <Columns/ColumnTuple.h>
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypeLowCardina... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> | Fully dynamic β keys and value types can vary per row. Typed path hints can be declared for known paths. |
Use `JSON` when different keys need different value types, when the set of keys varies significantly across rows, or ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTypes/IDataType.h>
namespace DB
{
/** Map data type.
* Map is implemented as two arrays of keys and values.
* Serialization of type 'Map(<|fim_suffix|>TypeMap final : public IDataType
{
private:
DataTypePtr key_type;
DataTypePtr value_type;
/// 'nested' is a... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <DataTypes/DataTypeMapHelpers.h>
#include <Columns/ColumnArray.h>
#include <Columns/ColumnFixedString.h>
#include <Columns/ColumnNullable.h>
#include <Columns/ColumnString.h>
#include <Columns/ColumnTuple.h>
#include <Columns/ColumnVector.h>
#include <Common/assert_cast.h>
#include <base/memcmpS... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>nal<std::pair<String, String>> tryParseMapSubcolumnName(const String & column_name);
}
<|fim_prefix|>#pragma once
#include <Columns/IColumn.h>
#include <base/types.h>
#include <optional>
#include <utility>
namespace DB
{
/// Optimized extraction of values for a given constant key from a Map column
//... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <DataTypes/DataTypeNested.h>
#include <DataTypes/DataTypeFactory.h>
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypeTuple.h>
#include <IO/Operators.h>
#include <Common/quoteString.h>
#include <Parsers/ASTNameTypePair.h>
namespace DB
{
namespace ErrorCodes
{
extern const int... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTypes/DataTypeCustom.h>
#include <DataTypes/IDataType.h>
namespace DB
{
class DataTypeNestedCustomName final : public IDataTypeCustomNa<|fim_suffix|>taTypeNestedCustomName *>(data_type->getCustomName()) != nullptr;
}
}
<|fim_middle|>me
{
private:
DataTypes elems;
S... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>ullable.md).
The `Nothing` type can also used to denote empty arrays:
```sql
SELECT toTypeName(array())
```
```text
ββtoTypeName(array())ββ
β Array(Nothing) β
βββββββββββββββββββββββ
```
)DOCS_MD",
.syntax = "Nothing",
.examples = {},
.related = {},
});
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTypes/IDataTypeDummy.h>
namespace DB
{
/** Data type that cannot have any values.
* Used to<|fim_suffix|>alization(const SerializationInfoSettings &) const override;
};
}
<|fim_middle|> represent NULL of unknown type as Nullable(Nothing),
* and possibly for empty array ... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <DataTypes/DataTypeNullable.h>
#include <DataTypes/NullableUtils.h>
#include <DataTypes/DataTypeNothing.h>
#include <DataTypes/DataTypeFactory.h>
#include <DataTypes/Serializations/SerializationInfoSettings.h>
#include <DataTypes/Serializations/SerializationNullable.h>
#include <DataTypes/Seriali... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTypes/IDataType.h>
namespace DB
{
/// A nullable data type is an ordinary data type provided with a tag
/// indicating that it also contains the NULL value. The following class
/// embodies this concept.
class DataTypeNullable final : public IDataType
{
public:
static con... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>
bool DataTypeNumberBase<T>::isValueRepresentedByInteger() const
{
return is_integer<T>;
}
template <typename T>
bool DataTypeNumberBase<T>::isValueRepresentedByUnsignedInteger() const
{
return is_integer<T> && is_unsigned_v<T>;
}
/// Explicit template instantiations - to avoid code bloat in hea... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> DataTypeNumberBase<UInt32>;
extern template class DataTypeNumberBase<UInt64>;
extern template class DataTypeNumberBase<UInt128>;
extern template class DataTypeNumberBase<UInt256>;
extern template class DataTypeNumberBase<Int16>;
extern template class DataTypeNumberBase<Int8>;
extern template class DataTy... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <Core/Field.h>
#include <DataTypes/DataTypeDynamic.h>
#include <DataTypes/IDataType.h>
namespace DB
{
class DataTypeObject final : public IDataType
{
public:
enum class SchemaFormat
{
JSON = 0<|fim_suffix|>BINED_SUBCOLUMN_PREFIX = '@';
explicit DataTypeObject... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>of vector elements and their number");
const DataTypePtr type = DataTypeFactory::instance().get(arguments->children[0]);
const auto * argument = arguments->children[1]->as<ASTLiteral>();
if (type->getTypeId() != TypeIndex::BFloat16 && type->getTypeId() != TypeIndex::Float32 && type->getTypeI... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTyp<|fim_suffix|> /* Number of elements in the vector */
const size_t dimension;
public:
DataTypeQBit(const DataTypePtr & element_type_, size_t dimension_);
TypeIndex getTypeId() const override { return TypeIndex::QBit; }
std::string doGetName() const override... | fim | ClickHouse/ClickHouse | c |
#pragma once
#include <DataTypes/IDataTypeDummy.h>
#include <Columns/ColumnSet.h>
namespace DB
{
/** The data type corresponding to the set of values in the IN section.
* Used only as an intermediate when evaluating expressions.
*/
class DataTypeSet final : public IDataTypeDummy
{
public:
static constexpr b... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <Columns/ColumnString.h>
#include <Columns/ColumnConst.h>
#include <Core/Field.h>
#include <DataTypes/DataTypeFactory.h>
#include <DataTypes/DataTypeString.h>
#include <DataTypes/Serializations/SerializationInfo.h>
#include <DataTypes/Serializations/SerializationString.h>
#include <Parsers/ASTLi... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>lable() const override { return true; }
bool canBeInsideLowCardinality() const override { return true; }
void updateHashImpl(SipHash &) const override {}
SerializationPtr doGetSerialization(const SerializationInfoSettings & settings) const override;
};
}
<|fim_prefix|>#pragma once
#include... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>st
{
// Time type has no additional parameters to hash
}
bool DataTypeTime::equals(const IDataType & rhs) const
{
return typeid(rhs) == typeid(*this);
}
SerializationPtr DataTypeTime::doGetSerialization(const SerializationInfoSettings &) const
{
return SerializationTime::create(*this);
}
co... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>transformations, unless 'use_client_time_zone' setting is passed to client;
* Server time zone is the time zone specified in 'timezone' parameter in configuration file,
* or system time zone at the moment of server startup.
*/
class DataTypeTime final : public DataTypeNumberBase<Int32>
{
public:
... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <string>
#include <DataTypes/DataTypeTime64.h>
#include <DataTypes/Serializations/SerializationTime64.h>
#include <IO/Operators.h>
#include <IO/WriteBufferFromString.h>
#include <Common/Exception.h>
namespace DB
{
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
extern const int BAD_ARGU... | fim | ClickHouse/ClickHouse | cpp |
#pragma once
#include <Core/Types.h>
#include <DataTypes/DataTypeDecimalBase.h>
#include <DataTypes/DataTypeNumberBase.h>
#include <DataTypes/DataTypeTime.h>
#include <Common/DateLUT.h>
class DateLUTImpl;
namespace DB
{
/** DateTime64 is same as DateTime, but it stores values as Int64 and has configurable sub-secon... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>size())
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Names are specified not for all elements of Tuple type");
return std::make_shared<DataTypeTuple>(nested_types, names);
}
void registerDataTypeTuple(DataTypeFactory & factory)
{
factory.registerDataType("Tuple", create, DataTypeFactory::... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTypes/IDataType.h>
#include <optional>
namespace DB
{
/** Tuple data type.
* Used as an intermediate result when evaluating expressions.
* Also can be used as a column - the result of the query execution.
*
* Tuple elements can have names.
* If an element is unname... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>
```sql
INSERT INTO t_uuid (y) VALUES ('Example 2')
SELECT * FROM t_uuid
```
```text
βββββββββββββββββββββββββββββββββββββxββ¬βyββββββββββ
β 417ddc5d-e556-4d27-95dd-a34d84e46a50 β Example 1 β
β 00000000-0000-0000-0000-000000000000 β Example 2 β
ββββββββββββββββββββββββββββββββββββββββ΄ββββββββββββ
```
#... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>l textCanContainOnlyValidUTF8() const override { return true; }
bool isComparable() const override { return true; }
bool isValueUnambiguouslyRepresentedInContiguousMemoryRegion() const override { return true; }
bool isValueUnambiguouslyRepresentedInFixedSizeContiguousMemoryRegion() const overr... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <Columns/ColumnVariant.h>
#include <Columns/ColumnConst.h>
#include <Core/Field.h>
#include <DataTypes/DataTypeVariant.h>
#include <DataTypes/DataTypeFactory.h>
#include <DataTypes/DataTypeNullable.h>
#include <DataTypes/FieldToDataType.h>
#include <DataTypes/Serializations/SerializationVariant.... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTypes/IDataType.h>
#include <Columns/ColumnVariant.h>
#include <optional>
namespace DB
{
/** Variant data type.
* This type represents a union of other data types.
* For example, type Variant(T1, T2, ..., TN) means that each row of this type
* has a value of either typ... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>ption(ErrorCodes::INCORRECT_DATA, "Unexpected version of JSON type binary encoding");
size_t max_dynamic_paths = 0;
readVarUInt(max_dynamic_paths, buf);
if (max_dynamic_paths > DataTypeObject::MAX_DYNAMIC_PATHS_LIMIT)
throw Exception(ErrorCodes::INCORREC... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTypes/IDataType.h>
namespace DB
{
enum class BinaryTypeIndex : uint8_t
{
Nothing = 0x00,
UInt8 = 0x01,
UInt16 = 0x02,
UInt32 = 0x03,
UInt64 = 0x04,
UInt128 = 0x05,
UInt256 = 0x06,
Int8 = 0x07,
Int16 = 0x08,
Int32 = 0x09,
Int64 = 0x0... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>28");
addSimpleType(BinaryTypeIndex::UInt256, "UInt256");
addSimpleType(BinaryTypeIndex::Int8, "Int8");
addSimpleType(BinaryTypeIndex::Int16, "Int16");
addSimpleType(BinaryTypeIndex::Int32, "Int32");
addSimpleType(BinaryTypeIndex::Int64, "Int64");
addSimpleType(BinaryTypeIndex::Int... | fim | ClickHouse/ClickHouse | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.