mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
fix ci check
This commit is contained in:
parent
f2ca2175d1
commit
02ce70f738
@ -79,26 +79,6 @@ void SerializationBool::serializeTextEscaped(const IColumn & column, size_t row_
|
||||
}
|
||||
}
|
||||
|
||||
void SerializationBool::deserializeFromString(IColumn & column, String & input, const FormatSettings & settings) const
|
||||
{
|
||||
ColumnUInt8 * col = typeid_cast<ColumnUInt8 *>(&column);
|
||||
if (!col)
|
||||
{
|
||||
throw Exception("Bool type can only deserialize columns of type UInt8." + column.getName(), ErrorCodes::ILLEGAL_COLUMN);
|
||||
}
|
||||
|
||||
if (settings.bool_true_representation == input)
|
||||
{
|
||||
col->insert(true);
|
||||
}
|
||||
else if (settings.bool_false_representation == input)
|
||||
{
|
||||
col->insert(false);
|
||||
}
|
||||
else
|
||||
throw Exception("Invalid boolean value, should be " + settings.bool_true_representation + " or " + settings.bool_false_representation + " controlled by setting bool_true_representation and bool_false_representation.", ErrorCodes::ILLEGAL_COLUMN);
|
||||
}
|
||||
|
||||
void SerializationBool::deserializeTextEscaped(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const
|
||||
{
|
||||
if (istr.eof())
|
||||
@ -167,4 +147,23 @@ void SerializationBool::deserializeTextRaw(IColumn & column, ReadBuffer & istr,
|
||||
deserializeFromString(column, input, settings);
|
||||
}
|
||||
|
||||
void SerializationBool::deserializeFromString(IColumn & column, String & input, const FormatSettings & settings)
|
||||
{
|
||||
ColumnUInt8 * col = typeid_cast<ColumnUInt8 *>(&column);
|
||||
if (!col)
|
||||
{
|
||||
throw Exception("Bool type can only deserialize columns of type UInt8." + column.getName(), ErrorCodes::ILLEGAL_COLUMN);
|
||||
}
|
||||
|
||||
if (settings.bool_true_representation == input)
|
||||
{
|
||||
col->insert(true);
|
||||
}
|
||||
else if (settings.bool_false_representation == input)
|
||||
{
|
||||
col->insert(false);
|
||||
}
|
||||
else
|
||||
throw Exception("Invalid boolean value, should be " + settings.bool_true_representation + " or " + settings.bool_false_representation + " controlled by setting bool_true_representation and bool_false_representation.", ErrorCodes::ILLEGAL_COLUMN);
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ public:
|
||||
void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
|
||||
void deserializeText(IColumn & column, ReadBuffer & istr, const FormatSettings & settings,bool whole) const override;
|
||||
|
||||
void deserializeFromString(IColumn & column, String & input, const FormatSettings & settings) const;
|
||||
|
||||
void serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const override;
|
||||
void deserializeTextEscaped(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const override;
|
||||
|
||||
@ -31,6 +29,8 @@ public:
|
||||
void serializeTextRaw(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const override;
|
||||
void deserializeTextRaw(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const override;
|
||||
|
||||
protected:
|
||||
static void deserializeFromString(IColumn & column, String & input, const FormatSettings & settings);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -237,7 +237,8 @@ inline void readBoolTextWord(bool & x, ReadBuffer & buf, bool support_upper_case
|
||||
if (buf.eof())
|
||||
throwReadAfterEOF();
|
||||
|
||||
switch (*buf.position()) {
|
||||
switch (*buf.position())
|
||||
{
|
||||
case 't':
|
||||
assertString("true", buf);
|
||||
x = true;
|
||||
|
@ -3,8 +3,8 @@ false test
|
||||
true test
|
||||
false test
|
||||
true test
|
||||
true test
|
||||
false test
|
||||
true test
|
||||
false test
|
||||
true test
|
||||
false test
|
||||
@ -13,8 +13,8 @@ true test
|
||||
{"value":true,"f":"test"}
|
||||
{"value":false,"f":"test"}
|
||||
{"value":true,"f":"test"}
|
||||
{"value":true,"f":"test"}
|
||||
{"value":false,"f":"test"}
|
||||
{"value":true,"f":"test"}
|
||||
{"value":false,"f":"test"}
|
||||
{"value":true,"f":"test"}
|
||||
{"value":false,"f":"test"}
|
||||
@ -23,8 +23,8 @@ true test
|
||||
1 test
|
||||
0 test
|
||||
1 test
|
||||
1 test
|
||||
0 test
|
||||
1 test
|
||||
0 test
|
||||
1 test
|
||||
0 test
|
||||
|
@ -5,7 +5,7 @@ CREATE TABLE bool_test (value Bool,f String) ENGINE = Memory;
|
||||
-- value column shoud have type 'Bool'
|
||||
SHOW CREATE TABLE bool_test;
|
||||
|
||||
INSERT INTO bool_test (value,f) VALUES ('false', 'test'), ('true' , 'test'), (0, 'test'), (1, 'test'), ('TRUE', 'test'), ('FALSE', 'test');
|
||||
INSERT INTO bool_test (value,f) VALUES ('false', 'test'), ('true' , 'test'), (0, 'test'), (1, 'test'), ('FALSE', 'test'), ('TRUE', 'test');
|
||||
INSERT INTO bool_test (value,f) FORMAT JSONEachRow {"value":false,"f":"test"}{"value":true,"f":"test"}{"value":0,"f":"test"}{"value":1,"f":"test"}
|
||||
|
||||
SELECT value,f FROM bool_test;
|
||||
|
Loading…
Reference in New Issue
Block a user