| 10 | |
| 11 | |
| 12 | class DataTypeArray final : public IDataType |
| 13 | { |
| 14 | private: |
| 15 | /// The type of array elements. |
| 16 | DataTypePtr nested; |
| 17 | |
| 18 | public: |
| 19 | using FieldType = Array; |
| 20 | using ColumnType = ColumnArray; |
| 21 | static constexpr bool is_parametric = true; |
| 22 | |
| 23 | explicit DataTypeArray(const DataTypePtr & nested_); |
| 24 | |
| 25 | TypeIndex getTypeId() const override { return TypeIndex::Array; } |
| 26 | |
| 27 | std::string doGetName() const override |
| 28 | { |
| 29 | return "Array(" + nested->getName() + ")"; |
| 30 | } |
| 31 | |
| 32 | std::string doGetPrettyName(size_t indent) const override; |
| 33 | |
| 34 | const char * getFamilyName() const override |
| 35 | { |
| 36 | return "Array"; |
| 37 | } |
| 38 | |
| 39 | bool canBeInsideNullable() const override |
| 40 | { |
| 41 | return false; |
| 42 | } |
| 43 | |
| 44 | MutableColumnPtr createColumn() const override; |
| 45 | |
| 46 | void forEachChild(const ChildCallback & callback) const override; |
| 47 | |
| 48 | Field getDefault() const override; |
| 49 | |
| 50 | DataTypePtr getNormalizedType() const override { return std::make_shared<DataTypeArray>(nested->getNormalizedType()); } |
| 51 | bool equals(const IDataType & rhs) const override; |
| 52 | bool isParametric() const override { return true; } |
| 53 | bool haveSubtypes() const override { return true; } |
| 54 | bool cannotBeStoredInTables() const override { return nested->cannotBeStoredInTables(); } |
| 55 | bool textCanContainOnlyValidUTF8() const override { return nested->textCanContainOnlyValidUTF8(); } |
| 56 | bool isComparable() const override { return nested->isComparable(); } |
| 57 | bool canBeComparedWithCollation() const override { return nested->canBeComparedWithCollation(); } |
| 58 | |
| 59 | /// Array column doesn't have subcolumns by itself but allows to read subcolumns of nested column. |
| 60 | /// If nested column has dynamic subcolumns, Array of this type should also be able to read these dynamic subcolumns. |
| 61 | bool hasDynamicSubcolumnsData() const override { return nested->hasDynamicSubcolumnsData(); } |
| 62 | bool hasDynamicStructure() const override { return nested->hasDynamicStructure(); } |
| 63 | std::unique_ptr<SubstreamData> getDynamicSubcolumnData(std::string_view subcolumn_name, const SubstreamData & data, size_t initial_array_level, bool throw_if_null) const override; |
| 64 | |
| 65 | bool isValueUnambiguouslyRepresentedInContiguousMemoryRegion() const override |
| 66 | { |
| 67 | return nested->isValueUnambiguouslyRepresentedInFixedSizeContiguousMemoryRegion(); |
| 68 | } |
| 69 |
no outgoing calls
no test coverage detected