mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix incorrect key condition of fixed strings.
This commit is contained in:
parent
988b20a32c
commit
fcee786320
@ -191,7 +191,20 @@ Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const ID
|
||||
else if (which_type.isStringOrFixedString())
|
||||
{
|
||||
if (src.getType() == Field::Types::String)
|
||||
{
|
||||
if (which_type.isFixedString())
|
||||
{
|
||||
size_t n = assert_cast<const DataTypeFixedString &>(type).getN();
|
||||
const auto & src_str = src.get<String>();
|
||||
if (src_str.size() < n)
|
||||
{
|
||||
String src_str_extended = src_str;
|
||||
src_str_extended.resize(n);
|
||||
return src_str_extended;
|
||||
}
|
||||
}
|
||||
return src;
|
||||
}
|
||||
}
|
||||
else if (const DataTypeArray * type_array = typeid_cast<const DataTypeArray *>(&type))
|
||||
{
|
||||
|
@ -0,0 +1 @@
|
||||
8
|
@ -0,0 +1,7 @@
|
||||
DROP TABLE IF EXISTS test;
|
||||
|
||||
CREATE TABLE test(key FixedString(10)) ENGINE=MergeTree() PARTITION BY tuple() ORDER BY (key);
|
||||
INSERT INTO test SELECT toString(intDiv(number, 8)) FROM numbers(100);
|
||||
SELECT count() FROM test WHERE key = '1';
|
||||
|
||||
DROP TABLE IF EXISTS test;
|
Loading…
Reference in New Issue
Block a user