mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fixed errors with tuples [#METR-18149].
This commit is contained in:
parent
9208a72b5a
commit
402a4933e3
@ -332,8 +332,8 @@ public:
|
||||
for (size_t j = 0; j < num_elements; ++j)
|
||||
out_data.insertFrom(*columns[j], i);
|
||||
|
||||
out_offsets[i] = current_offset;
|
||||
current_offset += num_elements;
|
||||
out_offsets[i] = current_offset;
|
||||
}
|
||||
|
||||
block.getByPosition(result).column = out;
|
||||
|
@ -116,11 +116,18 @@ ColumnPtr ColumnConst<Tuple>::convertToFullColumn() const
|
||||
if (!type)
|
||||
throw Exception("Non-Tuple data type specified for ColumnConstTuple", ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
/// Ask data_type to create ColumnTuple of corresponding type
|
||||
ColumnPtr res = type->createColumn();
|
||||
static_cast<ColumnTuple &>(*res).insert(getDataFromHolderImpl());
|
||||
/// Create columns for each element and convert to full columns.
|
||||
const DataTypes & element_types = type->getElements();
|
||||
size_t tuple_size = element_types.size();
|
||||
Block block;
|
||||
|
||||
return res;
|
||||
for (size_t i = 0; i < tuple_size; ++i)
|
||||
block.insert(ColumnWithTypeAndName{
|
||||
element_types[i]->createConstColumn(s, static_cast<const TupleBackend &>(*data)[i])->convertToFullColumnIfConst(),
|
||||
element_types[i],
|
||||
""});
|
||||
|
||||
return std::make_shared<ColumnTuple>(block);
|
||||
}
|
||||
|
||||
void ColumnConst<Tuple>::getExtremes(Field & min, Field & max) const
|
||||
|
18
dbms/tests/queries/0_stateless/00348_tuples.reference
Normal file
18
dbms/tests/queries/0_stateless/00348_tuples.reference
Normal file
@ -0,0 +1,18 @@
|
||||
('1',2) 1 2
|
||||
('1',2) 1 2
|
||||
('1',2) 1 2
|
||||
('1',2) 1 2
|
||||
('1',2) 1 2
|
||||
[('1',2)] 1 2
|
||||
[('1',2)] 1 2
|
||||
[('1',2)] 1 2
|
||||
[('1',2)] 1 2
|
||||
[('1',2)] 1 2
|
||||
[('1',2)] 1 2
|
||||
[((1,'2'),[(3,[4])])] ((1,'2'),[(3,[4])]) (1,'2') [(3,[4])] 1 2 (3,[4]) 3 [4] 4
|
||||
[('1',4)]
|
||||
[('1',4)]
|
||||
[('1',4)]
|
||||
[('1',4)]
|
||||
[('1',4)]
|
||||
[('1',4)]
|
30
dbms/tests/queries/0_stateless/00348_tuples.sql
Normal file
30
dbms/tests/queries/0_stateless/00348_tuples.sql
Normal file
@ -0,0 +1,30 @@
|
||||
SELECT ('1',2) AS t, t.1, t.2;
|
||||
SELECT materialize(('1',2)) AS t, t.1, t.2;
|
||||
SELECT (materialize('1'),2) AS t, t.1, t.2;
|
||||
SELECT ('1',materialize(2)) AS t, t.1, t.2;
|
||||
SELECT (materialize('1'),materialize(2)) AS t, t.1, t.2;
|
||||
|
||||
SELECT [('1',2)] AS t, t[1].1, t[1].2;
|
||||
SELECT [materialize(('1',2))] AS t, t[1].1, t[1].2;
|
||||
SELECT [(materialize('1'),2)] AS t, t[1].1, t[1].2;
|
||||
SELECT [('1',materialize(2))] AS t, t[1].1, t[1].2;
|
||||
SELECT [(materialize('1'),materialize(2))] AS t, t[1].1, t[1].2;
|
||||
SELECT materialize([('1',2)]) AS t, t[1].1, t[1].2;
|
||||
|
||||
SELECT [((1, materialize('2')), [(3, [4])])] AS thing,
|
||||
thing[1],
|
||||
thing[1].1,
|
||||
thing[1].2,
|
||||
thing[1].1.1,
|
||||
thing[1].1.2,
|
||||
(thing[1].2)[1],
|
||||
(thing[1].2)[1].1,
|
||||
(thing[1].2)[1].2,
|
||||
((thing[1].2)[1].2)[1];
|
||||
|
||||
select arrayMap(t->tuple(t.1, t.2*2), [('1',2)]);
|
||||
select arrayMap(t->tuple(t.1, t.2*2), [materialize(('1',2))]);
|
||||
select arrayMap(t->tuple(t.1, t.2*2), [(materialize('1'),2)]);
|
||||
select arrayMap(t->tuple(t.1, t.2*2), [('1',materialize(2))]);
|
||||
select arrayMap(t->tuple(t.1, t.2*2), [(materialize('1'),materialize(2))]);
|
||||
select arrayMap(t->tuple(t.1, t.2*2), materialize([('1',2)]));
|
Loading…
Reference in New Issue
Block a user