mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
address 01825_type_json_18 test
This commit is contained in:
parent
dc19141d84
commit
8977e499c2
@ -981,4 +981,18 @@ Field FieldVisitorFoldDimension::operator()(const Array & x) const
|
||||
return res;
|
||||
}
|
||||
|
||||
DataTypePtr makeDummyTupleTypeForObject()
|
||||
{
|
||||
return std::make_shared<DataTypeTuple>(
|
||||
DataTypes{std::make_shared<DataTypeUInt8>()},
|
||||
Names{ColumnObject::COLUMN_NAME_DUMMY});
|
||||
}
|
||||
|
||||
void setAllObjectsToDummyTupleType(NamesAndTypesList & columns)
|
||||
{
|
||||
for (auto & column : columns)
|
||||
if (column.type->hasDynamicSubcolumns())
|
||||
column.type = createConcreteEmptyDynamicColumn(column.type);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -162,6 +162,8 @@ private:
|
||||
size_t num_dimensions_to_fold;
|
||||
};
|
||||
|
||||
void setAllObjectsToDummyTupleType(NamesAndTypesList & columns);
|
||||
|
||||
/// Receives range of objects, which contains collections
|
||||
/// of columns-like objects (e.g. ColumnsDescription or NamesAndTypesList)
|
||||
/// and deduces the common types of object columns for all entries.
|
||||
|
@ -7253,7 +7253,7 @@ MergeTreeData::MutableDataPartPtr MergeTreeData::createEmptyPart(MergeTreePartIn
|
||||
|
||||
auto block = metadata_snapshot->getSampleBlock();
|
||||
NamesAndTypesList columns = metadata_snapshot->getColumns().getAllPhysical().filter(block.getNames());
|
||||
extendObjectColumns(columns, object_columns, /*with_subcolumns*/ false);
|
||||
setAllObjectsToDummyTupleType(columns);
|
||||
|
||||
DB::IMergeTreeDataPart::TTLInfos move_ttl_infos;
|
||||
ReservationPtr reservation = reserveSpacePreferringTTLRules(metadata_snapshot, 0, move_ttl_infos, time(nullptr), 0, true);
|
||||
|
@ -6,22 +6,26 @@ all_2_2_0 data Tuple(k5 String)
|
||||
all_1_2_1 data Tuple(k1 String, k2 Tuple(k3 String, k4 String), k5 String)
|
||||
============
|
||||
1 ['aaa','ddd'] [['bbb','ccc'],['eee','fff']]
|
||||
all_1_2_2 data Tuple(_dummy UInt8)
|
||||
all_3_3_0 data Tuple(k1 Nested(k2 String, k3 Nested(k4 String)))
|
||||
============
|
||||
1 a 42
|
||||
2 b 4200
|
||||
4242
|
||||
all_1_3_3 data Tuple(_dummy UInt8)
|
||||
all_4_4_0 data Tuple(name String, value Int16)
|
||||
1 a 42
|
||||
2 b 4200
|
||||
3 a 42.123
|
||||
all_1_3_3 data Tuple(_dummy UInt8)
|
||||
all_4_4_0 data Tuple(name String, value Int16)
|
||||
all_5_5_0 data Tuple(name String, value Float64)
|
||||
1 a 42
|
||||
2 b 4200
|
||||
3 a 42.123
|
||||
4 a some
|
||||
all_1_3_3 data Tuple(_dummy UInt8)
|
||||
all_4_4_0 data Tuple(name String, value Int16)
|
||||
all_5_5_0 data Tuple(name String, value Float64)
|
||||
all_6_6_0 data Tuple(name String, value String)
|
||||
all_4_6_1 data Tuple(name String, value String)
|
||||
all_1_6_4 data Tuple(name String, value String)
|
||||
|
2
tests/queries/0_stateless/01825_type_json_18.reference
Normal file
2
tests/queries/0_stateless/01825_type_json_18.reference
Normal file
@ -0,0 +1,2 @@
|
||||
1 (1) Tuple(k1 Int8)
|
||||
1 ([1,2]) Tuple(k1 Array(Int8))
|
16
tests/queries/0_stateless/01825_type_json_18.sql
Normal file
16
tests/queries/0_stateless/01825_type_json_18.sql
Normal file
@ -0,0 +1,16 @@
|
||||
-- Tags: no-fasttest
|
||||
|
||||
SET allow_experimental_object_type = 1;
|
||||
|
||||
DROP TABLE IF EXISTS t_json_2;
|
||||
|
||||
CREATE TABLE t_json_2(id UInt64, data Object('JSON'))
|
||||
ENGINE = MergeTree ORDER BY tuple();
|
||||
|
||||
INSERT INTO t_json_2 FORMAT JSONEachRow {"id": 1, "data" : {"k1": 1}};
|
||||
SELECT id, data, toTypeName(data) FROM t_json_2 ORDER BY id;
|
||||
|
||||
TRUNCATE TABLE t_json_2;
|
||||
|
||||
INSERT INTO t_json_2 FORMAT JSONEachRow {"id": 1, "data" : {"k1": [1, 2]}};
|
||||
SELECT id, data, toTypeName(data) FROM t_json_2 ORDER BY id;
|
Loading…
Reference in New Issue
Block a user