ClickHouse / ClickHouse/ClickHouse

Materialized View with S3 Engine Treats {_partition_id} as Literal Path Instead of Resolving Partitions

Open
#84,419 0 comments 0 reactions 0 assignees View on GitHub
comp-materialized-view external unexpected behaviour
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

### Company or project name

_No response_

### Describe the unexpected behaviour

**Issue: `{_partition_id}` not resolving in S3-engine Materialized Views**

**Test Case:**
```sql
CREATE MATERIALIZED VIEW test.s3_partition_issue
(
`account_id` String,
`source_id` String,
`col1` UInt32
)
ENGINE = S3(
'https://s3.region.amazonaws.com/bucket/test/{_partition_id}/data.json',
'AWS_ACCESS_KEY_ID',
'AWS_SECRET_ACCESS_KEY',
'JSONEachRow'
)
PARTITION BY concat(account_id, '/', source_id)
AS SELECT
'test_account' AS account_id,
'test_source' AS source_id,
1 AS col1 from events

works when using regular insert

### Which ClickHouse versions are affected?

all versions tested on 24.11 and 25.5

### How to reproduce

create an s3 engine table with partition and attempt insertion via a trigger. Also tested using the Materialized View TO syntax version

### Expected behavior

resolve {_partition_id} as expected in s3

### Error message and/or stacktrace

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.