#pragma once #include #include #include #include namespace DB { class DataTypeIPv4 : public IDataType { public: static constexpr bool is_parametric = false; using FieldType = IPv4; using ColumnType = ColumnVector; static constexpr auto type_id = TypeToTypeIndex; const char * getFamilyName() const override { return TypeName.data(); } TypeIndex getTypeId() const override { return type_id; } Field getDefault() const override { return IPv4{}; } MutableColumnPtr createColumn() const override {return ColumnVector::create();} bool isParametric() const override { return false; } bool haveSubtypes() const override { return false; } bool equals(const IDataType & rhs) const override { return typeid(rhs) == typeid(*this); } bool canBeUsedInBitOperations() const override { return true; } bool canBeInsideNullable() const override { return true; } bool canBePromoted() const override { return false; } bool shouldAlignRightInPrettyFormats() const override { return false; } bool textCanContainOnlyValidUTF8() const override { return true; } bool isComparable() const override { return true; } bool isValueRepresentedByNumber() const override { return true; } bool isValueRepresentedByInteger() const override { return true; } bool isValueRepresentedByUnsignedInteger() const override { return true; } bool isValueUnambiguouslyRepresentedInContiguousMemoryRegion() const override { return true; } bool isValueUnambiguouslyRepresentedInFixedSizeContiguousMemoryRegion() const override { return true; } bool haveMaximumSizeOfValue() const override { return true; } size_t getSizeOfValueInMemory() const override { return sizeof(IPv4); } bool isCategorial() const override { return true; } bool canBeInsideLowCardinality() const override { return true; } SerializationPtr doGetDefaultSerialization() const override { return std::make_shared>(); } }; class DataTypeIPv6 : public IDataType { public: static constexpr bool is_parametric = false; using FieldType = IPv6; using ColumnType = ColumnVector; static constexpr auto type_id = TypeToTypeIndex; const char * getFamilyName() const override { return TypeName.data(); } TypeIndex getTypeId() const override { return type_id; } Field getDefault() const override { return IPv6{}; } MutableColumnPtr createColumn() const override {return ColumnVector::create();} bool isParametric() const override { return false; } bool haveSubtypes() const override { return false; } bool equals(const IDataType & rhs) const override { return typeid(rhs) == typeid(*this); } bool canBeUsedInBitOperations() const override { return true; } bool canBeInsideNullable() const override { return true; } bool canBePromoted() const override { return false; } bool shouldAlignRightInPrettyFormats() const override { return false; } bool textCanContainOnlyValidUTF8() const override { return true; } bool isComparable() const override { return true; } bool isValueUnambiguouslyRepresentedInContiguousMemoryRegion() const override { return true; } bool isValueUnambiguouslyRepresentedInFixedSizeContiguousMemoryRegion() const override { return true; } bool haveMaximumSizeOfValue() const override { return true; } size_t getSizeOfValueInMemory() const override { return sizeof(IPv6); } bool isCategorial() const override { return true; } bool canBeInsideLowCardinality() const override { return true; } SerializationPtr doGetDefaultSerialization() const override { return std::make_shared>(); } }; }