forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataTypeArray.h
More file actions
80 lines (57 loc) · 2.74 KB
/
Copy pathDataTypeArray.h
File metadata and controls
80 lines (57 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#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 ColumnType = ColumnArray;
static constexpr bool is_parametric = true;
explicit DataTypeArray(const DataTypePtr & nested_);
TypeIndex getTypeId() const override { return TypeIndex::Array; }
std::string doGetName() const override
{
return "Array(" + nested->getName() + ")";
}
std::string doGetPrettyName(size_t indent) const override;
const char * getFamilyName() const override
{
return "Array";
}
bool canBeInsideNullable() const override
{
return false;
}
MutableColumnPtr createColumn() const override;
void forEachChild(const ChildCallback & callback) const override;
Field getDefault() const override;
DataTypePtr getNormalizedType() const override { return std::make_shared<DataTypeArray>(nested->getNormalizedType()); }
bool equals(const IDataType & rhs) const override;
bool isParametric() const override { return true; }
bool haveSubtypes() const override { return true; }
bool cannotBeStoredInTables() const override { return nested->cannotBeStoredInTables(); }
bool textCanContainOnlyValidUTF8() const override { return nested->textCanContainOnlyValidUTF8(); }
bool isComparable() const override { return nested->isComparable(); }
bool canBeComparedWithCollation() const override { return nested->canBeComparedWithCollation(); }
/// Array column doesn't have subcolumns by itself but allows to read subcolumns of nested column.
/// If nested column has dynamic subcolumns, Array of this type should also be able to read these dynamic subcolumns.
bool hasDynamicSubcolumnsData() const override { return nested->hasDynamicSubcolumnsData(); }
bool hasDynamicStructure() const override { return nested->hasDynamicStructure(); }
std::unique_ptr<SubstreamData> getDynamicSubcolumnData(std::string_view subcolumn_name, const SubstreamData & data, size_t initial_array_level, bool throw_if_null) const override;
bool isValueUnambiguouslyRepresentedInContiguousMemoryRegion() const override
{
return nested->isValueUnambiguouslyRepresentedInFixedSizeContiguousMemoryRegion();
}
void updateHashImpl(SipHash & hash) const override;
SerializationPtr doGetSerialization(const SerializationInfoSettings & settings) const override;
const DataTypePtr & getNestedType() const { return nested; }
/// 1 for plain array, 2 for array of arrays and so on.
size_t getNumberOfDimensions() const;
};
}