Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timeout_overflow_mode when having subquery in the rhs of IN #53439

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Interpreters/PreparedSets.cpp
Expand Up @@ -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 the sub-query timeout, but we set
/// timeout_overflow_mode to `break` so no exception is throw 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;
}
Expand Down
Empty file.
10 changes: 10 additions & 0 deletions tests/queries/0_stateless/02844_subquery_timeout_with_break.sql
@@ -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;