Am1rr3zA opened a new issue, #9060:
URL: https://github.com/apache/iceberg/issues/9060
### Feature Request / Improvement
I want to be able to support Tagging at partition level.
Let's consider a straightforward fact table that requires restating at
specific times: one day after and seven days after its initial creation. I aim
to label my partitions as '0-day,' '1-day,' and '7-day' to facilitate easy
access to historical data whenever needed.
To show by example let's say this is the table:
```
CREATE TABLE IF NOT EXISTS my_iceberg_fact_table(
id INT,
name STRING,
sale DOUBLE,
region INT,
my_date DATE
) USING iceberg
PARTITIONED BY (region, my_date)
```
Some data get inserted in `0-day` Time
```
INSERT INTO my_iceberg_fact_table VALUES
(1, 'John', 10.5, 1, date '2023-11-12'),
(2, 'Jane', 20.0, 2, date '2023-11-12'),
(3, 'Jim', 15.0, 1, date '2023-11-12'),
(4, 'Jack', 12.3, 3, date '2023-11-12')
```
And after 1 day it get updated
```
CREATE OR REPLACE TEMPORARY VIEW updated_data AS
SELECT
1 AS id,
'John' AS name,
200.0 AS sale,
1 AS region,
DATE('2023-11-12') AS my_date
UNION ALL
SELECT
2 AS id,
'Alice' AS name,
100 AS sale,
2 AS region,
DATE('2023-11-12') AS my_date
MERGE INTO my_iceberg_fact_table t
USING updated_data s
ON t.id = s.id AND t.region = s.region AND t.my_date = s.my_date
WHEN MATCHED THEN UPDATE SET
t.sale = s.sale
```
Now I want to be able to query the Partition like this
```
SELECT * FROM my_iceberg_fact_table where region=1 and my_date= '2023-11-14'
AS OF 0-day;
or
SELECT * FROM my_iceberg_fact_table where region=1 and my_date= '2023-11-14'
AS OF 1-day;
```
**Note**: For each distinct partition, I intend to apply the same set of
tags. While my understanding is that the table-level tag is unique, at the
partition level, I aim to designate the '0-day' tag for each specific
combination of 'region' and 'my_date'
Something like this should be possible:
```
SELECT * FROM my_iceberg_fact_table where region=1 and my_date= '2023-11-14'
AS OF 0-day;
SELECT * FROM my_iceberg_fact_table where region=2 and my_date= '2023-11-14'
AS OF 0-day;
SELECT * FROM my_iceberg_fact_table where region=1 and my_date= '2023-11-15'
AS OF 0-day;
...
```
### Query engine
Spark
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]