Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
askwang committed Oct 17, 2024
1 parent ea7e0a7 commit f5faad6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
10 changes: 5 additions & 5 deletions docs/content/spark/sql-ddl.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,19 +214,19 @@ CREATE TABLE my_table_all_as PARTITIONED BY (dt) TBLPROPERTIES ('primary-key' =
### Create Tag
Create a tag based on snapshot or retention.
```sql
-- create a tag based on lastest snapshot and no retention.
-- create a tag based on the latest 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.
-- create a tag based on the latest 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.
-- create a tag based on the latest 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.
-- 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.
-- create a tag based on snapshot-2 and retain it for 12 hour.
ALTER TABLE T CREATE TAG `TAG-4` AS OF VERSION 2 RETAIN 12 HOURS;
```

Expand Down
13 changes: 3 additions & 10 deletions paimon-common/src/main/java/org/apache/paimon/utils/TimeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,10 @@ public static Duration parseDuration(String text) {
* @param number a digital number
* @param unitLabel time unit label
*/
public static Duration parseDuration(Long number, String unitLabel) {
public static Duration parseDuration(long number, String unitLabel) {
ChronoUnit unit = LABEL_TO_UNIT_MAP.get(unitLabel.toLowerCase(Locale.US));
if (unit != null) {
return Duration.of(number, unit);
} else {
throw new IllegalArgumentException(
"Time interval unit label '"
+ unitLabel
+ "' does not match any of the recognized units: "
+ TimeUnit.getAllUnits());
}
checkNotNull(unit);
return Duration.of(number, unit);
}

private static Map<String, ChronoUnit> initMap() {
Expand Down

0 comments on commit f5faad6

Please sign in to comment.