wwj6591812 commented on code in PR #4329:
URL: https://github.com/apache/paimon/pull/4329#discussion_r1803305740
##########
docs/content/spark/sql-ddl.md:
##########
@@ -210,8 +210,48 @@ CREATE TABLE my_table_all (
CREATE TABLE my_table_all_as PARTITIONED BY (dt) TBLPROPERTIES ('primary-key'
= 'dt,hh') AS SELECT * FROM my_table_all;
```
-## Show Tags
-The SHOW TAGS statement is used to list all tags of a table.
+## Tag DDL
+### Create Tag
+Create a tag based on snapshot or retention.
+```sql
+-- create a tag based on lastest snapshot and no retention.
Review Comment:
lastest -> the latest
##########
docs/content/spark/sql-ddl.md:
##########
@@ -210,8 +210,48 @@ CREATE TABLE my_table_all (
CREATE TABLE my_table_all_as PARTITIONED BY (dt) TBLPROPERTIES ('primary-key'
= 'dt,hh') AS SELECT * FROM my_table_all;
```
-## Show Tags
-The SHOW TAGS statement is used to list all tags of a table.
+## Tag DDL
+### Create Tag
+Create a tag based on snapshot or retention.
+```sql
+-- create a tag based on lastest snapshot and no retention.
+ALTER TABLE T CREATE TAG `TAG-1`;
+
+-- create a tag based on lastest snapshot and no retention if it doesn't exist.
Review Comment:
lastest -> the latest
##########
paimon-common/src/main/java/org/apache/paimon/utils/TimeUtils.java:
##########
@@ -104,6 +104,26 @@ public static Duration parseDuration(String text) {
}
}
+ /**
+ * Parse the given number and unitLabel to a java {@link Duration}. The
usage is in format
+ * "(digital number, time unit label)", e.g. "(1, DAYS)".
+ *
+ * @param number a digital number
+ * @param unitLabel time unit label
+ */
+ public static Duration parseDuration(Long number, String unitLabel) {
+ ChronoUnit unit =
LABEL_TO_UNIT_MAP.get(unitLabel.toLowerCase(Locale.US));
+ if (unit != null) {
Review Comment:
checkNotNull(xxx);
return Duration.of(number, unit);
##########
paimon-common/src/main/java/org/apache/paimon/utils/TimeUtils.java:
##########
@@ -104,6 +104,26 @@ public static Duration parseDuration(String text) {
}
}
+ /**
+ * Parse the given number and unitLabel to a java {@link Duration}. The
usage is in format
+ * "(digital number, time unit label)", e.g. "(1, DAYS)".
+ *
+ * @param number a digital number
+ * @param unitLabel time unit label
+ */
+ public static Duration parseDuration(Long number, String unitLabel) {
Review Comment:
long number
##########
docs/content/spark/sql-ddl.md:
##########
@@ -210,8 +210,48 @@ CREATE TABLE my_table_all (
CREATE TABLE my_table_all_as PARTITIONED BY (dt) TBLPROPERTIES ('primary-key'
= 'dt,hh') AS SELECT * FROM my_table_all;
```
-## Show Tags
-The SHOW TAGS statement is used to list all tags of a table.
+## Tag DDL
+### Create Tag
+Create a tag based on snapshot or retention.
+```sql
+-- create a tag based on lastest snapshot and no retention.
+ALTER TABLE T CREATE TAG `TAG-1`;
+
+-- create a tag based on lastest snapshot and no retention if it doesn't exist.
+ALTER TABLE T CREATE TAG IF NOT EXISTS `TAG-1`;
+
+-- create a tag based on lastest snapshot and retain it for 7 day.
Review Comment:
lastest -> the latest
##########
docs/content/spark/sql-ddl.md:
##########
@@ -210,8 +210,48 @@ CREATE TABLE my_table_all (
CREATE TABLE my_table_all_as PARTITIONED BY (dt) TBLPROPERTIES ('primary-key'
= 'dt,hh') AS SELECT * FROM my_table_all;
```
-## Show Tags
-The SHOW TAGS statement is used to list all tags of a table.
+## Tag DDL
+### Create Tag
+Create a tag based on snapshot or retention.
+```sql
+-- create a tag based on lastest snapshot and no retention.
+ALTER TABLE T CREATE TAG `TAG-1`;
+
+-- create a tag based on lastest snapshot and no retention if it doesn't exist.
+ALTER TABLE T CREATE TAG IF NOT EXISTS `TAG-1`;
+
+-- create a tag based on lastest snapshot and retain it for 7 day.
+ALTER TABLE T CREATE TAG `TAG-2` RETAIN 7 DAYS;
+
+-- create a tag based on snapshot 1 and no retention.
+ALTER TABLE T CREATE TAG `TAG-3` AS OF VERSION 1;
+
+-- create a tag based on snapshot 2 and retain it for 12 hour.
Review Comment:
snapshot-2
##########
docs/content/spark/sql-ddl.md:
##########
@@ -210,8 +210,48 @@ CREATE TABLE my_table_all (
CREATE TABLE my_table_all_as PARTITIONED BY (dt) TBLPROPERTIES ('primary-key'
= 'dt,hh') AS SELECT * FROM my_table_all;
```
-## Show Tags
-The SHOW TAGS statement is used to list all tags of a table.
+## Tag DDL
+### Create Tag
+Create a tag based on snapshot or retention.
+```sql
+-- create a tag based on lastest snapshot and no retention.
+ALTER TABLE T CREATE TAG `TAG-1`;
+
+-- create a tag based on lastest snapshot and no retention if it doesn't exist.
+ALTER TABLE T CREATE TAG IF NOT EXISTS `TAG-1`;
+
+-- create a tag based on lastest snapshot and retain it for 7 day.
+ALTER TABLE T CREATE TAG `TAG-2` RETAIN 7 DAYS;
+
+-- create a tag based on snapshot 1 and no retention.
Review Comment:
snapshot-1
--
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]