fix reading of empty arrays in reverse order

This commit is contained in:
Anton Popov 2022-04-13 21:50:57 +00:00
parent fcb83a12ff
commit 0595b5c22b
3 changed files with 24 additions and 1 deletions

View File

@ -62,7 +62,7 @@ void CompressedReadBufferFromFile::seek(size_t offset_in_compressed_file, size_t
{
/// Nothing to do if we already at required position
if (!size_compressed && static_cast<size_t>(file_in.getPosition()) == offset_in_compressed_file && /// correct position in compressed file
(offset() == offset_in_decompressed_block /// correct position in buffer or
((!buffer().empty() && offset() == offset_in_decompressed_block) /// correct position in buffer or
|| nextimpl_working_buffer_offset == offset_in_decompressed_block)) /// we will move our position to correct one
return;

View File

@ -0,0 +1 @@
['x'] 0 ['1','2','3','4','5','6']

View File

@ -0,0 +1,22 @@
DROP TABLE IF EXISTS t_02267;
CREATE TABLE t_02267
(
a Array(String),
b UInt32,
c Array(String)
)
ENGINE = MergeTree
ORDER BY b
SETTINGS index_granularity = 500;
INSERT INTO t_02267 (b, a, c) SELECT 0, ['x'], ['1','2','3','4','5','6'] FROM numbers(1) ;
INSERT INTO t_02267 (b, a, c) SELECT 1, [], ['1','2','3','4','5','6'] FROM numbers(300000);
OPTIMIZE TABLE t_02267 FINAL;
SELECT * FROM t_02267 WHERE hasAll(a, ['x'])
ORDER BY b DESC
SETTINGS max_threads=1, max_block_size=1000;
DROP TABLE IF EXISTS t_02267;