-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
TTL materialization fail when table contains projection #53740
Comments
@amosbird boss, if you've got time, please have a look at this. Not sure if this is a bug in projection or a expected behavior that can be fixed with some settings. Thanks a lot! |
production table error log looks like this (replaced the aggregated column with xxx): 2023.08.23 10:21:10.719443 [ 332 ] {} d098e71f-2ef5-4ca0-9360-25f4d50bbaae::20230120_1_5_2_6 (MutateFromLogEntryTask): virtual bool DB::ReplicatedMergeMutateTaskBase::executeStep(): Code: 47. DB::Exception: Missing columns: 'xxx' while processing query: 'SELECT event_day, sum(xxx) GROUP BY event_day', required columns: 'event_day' 'xxx' 'event_day' 'xxx'. (UNKNOWN_IDENTIFIER), Stack trace (when copying this message, always include the lines below):
|
@Ravojay I cannot reproduce the issue using latest main branch. |
@amosbird |
Well, we need to find out what PR fixed this issue first. |
I think its somewhere between these two version: |
Describe the unexpected behaviour
I encountered a problem with projection and TTL modification.
Modifying TTL for table (with materialize_ttl_recalculate_only set to 1) with projection may lead to a 'missing column' exception.
How to reproduce
CREATE TABLE test.test_modify_ttl_local ( event_day Date, cnt Int64, PROJECTION proj_xxx ( SELECT event_day, sum(cnt) GROUP BY event_day ) ) ENGINE = MergeTree PARTITION BY event_day ORDER BY event_day TTL event_day + toIntervalDay(400) SETTINGS index_granularity = 8192, materialize_ttl_recalculate_only = 1, old_parts_lifetime = 60
Query id: ea07d6ef-74a0-48e7-8190-4011c58133f4
Ok.
0 rows in set. Elapsed: 0.004 sec.
INSERT INTO test.test_modify_ttl_local SELECT '2023-08-22', 1 FROM numbers(10000000)
Query id: 86dfa0df-ddfa-4595-b27a-643235c96218
Ok.
0 rows in set. Elapsed: 0.737 sec. Processed 20.48 million rows, 183.88 MB (27.79 million rows/s., 249.43 MB/s.)
ALTER TABLE test.test_modify_ttl_local MODIFY TTL event_day + toIntervalDay(500)
Query id: 9ebfbb00-0482-4b18-9df8-f3461ef056e9
0 rows in set. Elapsed: 0.007 sec.
Received exception from server (version 23.3.7):
Code: 341. DB::Exception: Received from localhost:2036. DB::Exception: Exception happened during execution of mutation 'mutation_33.txt' with part '20230822_23_32_2' reason: 'Code: 47. DB::Exception: Missing columns: 'cnt' while processing query: 'SELECT event_day, sum(cnt) GROUP BY event_day', required columns: 'event_day' 'cnt' 'event_day' 'cnt'. (UNKNOWN_IDENTIFIER) (version 23.3.7.1)'. This error maybe retryable or not. In case of unretryable error, mutation can be killed with KILL MUTATION query. (UNFINISHED)
** Which ClickHouse server version to use**
version 23.3.7
Expected behavior
expect the TTL to be materialized normally
Additional context
After resetting materialize_ttl_recalculate_only to zero, TTL can be materialized successfully.
Also, when the inserted data is fewer, say 1000000 (1/10 of the case above), TTL materialization is also executed successfully. Seems that fewer data leads to compact part, not sure if that's relevant
The text was updated successfully, but these errors were encountered: