Fix bad formatting of IPv4 addresses

This commit is contained in:
Alexey Milovidov 2021-01-21 03:24:44 +03:00
parent af4afff723
commit 2d87e52b3a
4 changed files with 13 additions and 2 deletions

View File

@ -51,7 +51,13 @@ public:
bool isParametric() const override { return false; } bool isParametric() const override { return false; }
bool haveSubtypes() const override { return false; } bool haveSubtypes() const override { return false; }
bool shouldAlignRightInPrettyFormats() const override { return true; }
bool shouldAlignRightInPrettyFormats() const override
{
/// Just a number, without customizations. Counterexample: IPv4.
return !custom_text_serialization;
}
bool textCanContainOnlyValidUTF8() const override { return true; } bool textCanContainOnlyValidUTF8() const override { return true; }
bool isComparable() const override { return true; } bool isComparable() const override { return true; }
bool isValueRepresentedByNumber() const override { return true; } bool isValueRepresentedByNumber() const override { return true; }

View File

@ -497,7 +497,7 @@ public:
/// For all other substreams (like ArraySizes, NullMasks, etc.) we use only /// For all other substreams (like ArraySizes, NullMasks, etc.) we use only
/// generic compression codecs like LZ4. /// generic compression codecs like LZ4.
static bool isSpecialCompressionAllowed(const SubstreamPath & path); static bool isSpecialCompressionAllowed(const SubstreamPath & path);
private: protected:
friend class DataTypeFactory; friend class DataTypeFactory;
friend class AggregateFunctionSimpleState; friend class AggregateFunctionSimpleState;
/// Customize this DataType /// Customize this DataType

View File

@ -0,0 +1,4 @@
┌─x───────────────┬─y───────────────┬──────────z─┐
│ 1.1.1.1 │ 1.1.1.1 │ 16843009 │
│ 255.255.255.255 │ 255.255.255.255 │ 4294967295 │
└─────────────────┴─────────────────┴────────────┘

View File

@ -0,0 +1 @@
SELECT arrayJoin(['1.1.1.1', '255.255.255.255']) AS x, toIPv4(x) AS y, toUInt32(y) AS z FORMAT PrettyCompactNoEscapes;