Merge pull request #53439 from canhld94/timeout_overflow_break_subquery

Fix timeout_overflow_mode when having subquery in the rhs of IN
This commit is contained in:
Alexey Milovidov 2023-08-19 02:24:42 +03:00 committed by GitHub
commit 00e2e3184b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -198,7 +198,11 @@ SetPtr FutureSetFromSubquery::buildOrderedSetInplace(const ContextPtr & context)
CompletedPipelineExecutor executor(pipeline);
executor.execute();
set_and_key->set->checkIsCreated();
/// SET may not be created successfully at this step because of the sub-query timeout, but if we have
/// timeout_overflow_mode set to `break`, no exception is thrown, and the executor just stops executing
/// the pipeline without setting `set_and_key->set->is_created` to true.
if (!set_and_key->set->isCreated())
return nullptr;
return set_and_key->set;
}

View File

@ -0,0 +1,10 @@
DROP TABLE IF EXISTS t;
CREATE TABLE t (key UInt64, value UInt64, INDEX value_idx value TYPE bloom_filter GRANULARITY 1) ENGINE=MergeTree() ORDER BY key;
INSERT INTO t SELECT number, rand()%1000 FROM numbers(10000);
SET timeout_overflow_mode='break';
SET max_execution_time=0.1;
SELECT * FROM t WHERE value IN (SELECT number FROM numbers(1000000000));
DROP TABLE t;