The expiration interval of a partition. A partition will be expired if it‘s lifetime is over this value. Partition time is extracted from the partition value.
+
+
partition.legacy-name
+
true
+
Boolean
+
The legacy partition name is using `toString` fpr all types. If false, using cast to string for all types.
+
partition.mark-done-action
"success-file"
diff --git a/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java b/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java
index d965fd142deb..18dae0d38416 100644
--- a/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java
+++ b/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java
@@ -250,6 +250,14 @@ public class CoreOptions implements Serializable {
"The default partition name in case the dynamic partition"
+ " column value is null/empty string.");
+ public static final ConfigOption PARTITION_GENERATE_LEGCY_NAME =
+ key("partition.legacy-name")
+ .booleanType()
+ .defaultValue(true)
+ .withDescription(
+ "The legacy partition name is using `toString` fpr all types. If false, using "
+ + "cast to string for all types.");
+
public static final ConfigOption SNAPSHOT_NUM_RETAINED_MIN =
key("snapshot.num-retained.min")
.intType()
@@ -1539,6 +1547,10 @@ public String partitionDefaultName() {
return options.get(PARTITION_DEFAULT_NAME);
}
+ public boolean legacyPartitionName() {
+ return options.get(PARTITION_GENERATE_LEGCY_NAME);
+ }
+
public boolean sortBySize() {
return options.get(SORT_RANG_STRATEGY) == RangeStrategy.SIZE;
}
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/AbstractCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/AbstractCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/AbstractCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/AbstractCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/BinaryToBinaryCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/BinaryToBinaryCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/BinaryToBinaryCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/BinaryToBinaryCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/BinaryToStringCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/BinaryToStringCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/BinaryToStringCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/BinaryToStringCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/BooleanToNumericCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/BooleanToNumericCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/BooleanToNumericCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/BooleanToNumericCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/BooleanToStringCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/BooleanToStringCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/BooleanToStringCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/BooleanToStringCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/CastExecutor.java b/paimon-common/src/main/java/org/apache/paimon/casting/CastExecutor.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/CastExecutor.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/CastExecutor.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/CastExecutors.java b/paimon-common/src/main/java/org/apache/paimon/casting/CastExecutors.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/CastExecutors.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/CastExecutors.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/CastFieldGetter.java b/paimon-common/src/main/java/org/apache/paimon/casting/CastFieldGetter.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/CastFieldGetter.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/CastFieldGetter.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/CastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/CastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/CastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/CastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/CastRulePredicate.java b/paimon-common/src/main/java/org/apache/paimon/casting/CastRulePredicate.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/CastRulePredicate.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/CastRulePredicate.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/CastedRow.java b/paimon-common/src/main/java/org/apache/paimon/casting/CastedRow.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/CastedRow.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/CastedRow.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/DateToStringCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/DateToStringCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/DateToStringCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/DateToStringCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/DateToTimestampCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/DateToTimestampCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/DateToTimestampCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/DateToTimestampCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/DecimalToDecimalCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/DecimalToDecimalCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/DecimalToDecimalCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/DecimalToDecimalCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/DecimalToNumericPrimitiveCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/DecimalToNumericPrimitiveCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/DecimalToNumericPrimitiveCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/DecimalToNumericPrimitiveCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/DefaultValueRow.java b/paimon-common/src/main/java/org/apache/paimon/casting/DefaultValueRow.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/DefaultValueRow.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/DefaultValueRow.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/NumericPrimitiveCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/NumericPrimitiveCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/NumericPrimitiveCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/NumericPrimitiveCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/NumericPrimitiveToDecimalCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/NumericPrimitiveToDecimalCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/NumericPrimitiveToDecimalCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/NumericPrimitiveToDecimalCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/NumericPrimitiveToTimestamp.java b/paimon-common/src/main/java/org/apache/paimon/casting/NumericPrimitiveToTimestamp.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/NumericPrimitiveToTimestamp.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/NumericPrimitiveToTimestamp.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/NumericToBooleanCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/NumericToBooleanCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/NumericToBooleanCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/NumericToBooleanCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/NumericToStringCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/NumericToStringCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/NumericToStringCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/NumericToStringCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/StringToBinaryCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/StringToBinaryCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/StringToBinaryCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/StringToBinaryCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/StringToBooleanCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/StringToBooleanCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/StringToBooleanCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/StringToBooleanCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/StringToDateCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/StringToDateCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/StringToDateCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/StringToDateCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/StringToDecimalCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/StringToDecimalCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/StringToDecimalCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/StringToDecimalCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/StringToNumericPrimitiveCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/StringToNumericPrimitiveCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/StringToNumericPrimitiveCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/StringToNumericPrimitiveCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/StringToStringCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/StringToStringCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/StringToStringCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/StringToStringCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/StringToTimeCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/StringToTimeCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/StringToTimeCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/StringToTimeCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/StringToTimestampCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/StringToTimestampCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/StringToTimestampCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/StringToTimestampCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/TimeToStringCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/TimeToStringCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/TimeToStringCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/TimeToStringCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/TimeToTimestampCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/TimeToTimestampCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/TimeToTimestampCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/TimeToTimestampCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/TimestampToDateCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/TimestampToDateCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/TimestampToDateCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/TimestampToDateCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/TimestampToNumericPrimitiveCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/TimestampToNumericPrimitiveCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/TimestampToNumericPrimitiveCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/TimestampToNumericPrimitiveCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/TimestampToStringCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/TimestampToStringCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/TimestampToStringCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/TimestampToStringCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/TimestampToTimeCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/TimestampToTimeCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/TimestampToTimeCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/TimestampToTimeCastRule.java
diff --git a/paimon-core/src/main/java/org/apache/paimon/casting/TimestampToTimestampCastRule.java b/paimon-common/src/main/java/org/apache/paimon/casting/TimestampToTimestampCastRule.java
similarity index 100%
rename from paimon-core/src/main/java/org/apache/paimon/casting/TimestampToTimestampCastRule.java
rename to paimon-common/src/main/java/org/apache/paimon/casting/TimestampToTimestampCastRule.java
diff --git a/paimon-common/src/main/java/org/apache/paimon/utils/InternalRowPartitionComputer.java b/paimon-common/src/main/java/org/apache/paimon/utils/InternalRowPartitionComputer.java
index 881f0f4d1053..1bc8eecc88d1 100644
--- a/paimon-common/src/main/java/org/apache/paimon/utils/InternalRowPartitionComputer.java
+++ b/paimon-common/src/main/java/org/apache/paimon/utils/InternalRowPartitionComputer.java
@@ -20,6 +20,7 @@
import org.apache.paimon.data.BinaryRow;
import org.apache.paimon.data.InternalRow;
+import org.apache.paimon.types.DataType;
import org.apache.paimon.types.RowType;
import java.util.Arrays;
@@ -35,11 +36,18 @@ public class InternalRowPartitionComputer {
protected final String defaultPartValue;
protected final String[] partitionColumns;
protected final InternalRow.FieldGetter[] partitionFieldGetters;
+ protected final List types;
+ protected final boolean legacyPartitionName;
public InternalRowPartitionComputer(
- String defaultPartValue, RowType rowType, String[] partitionColumns) {
+ String defaultPartValue,
+ RowType rowType,
+ String[] partitionColumns,
+ boolean legacyPartitionName) {
this.defaultPartValue = defaultPartValue;
this.partitionColumns = partitionColumns;
+ this.types = rowType.getFieldTypes();
+ this.legacyPartitionName = legacyPartitionName;
List columnList = rowType.getFieldNames();
this.partitionFieldGetters =
Arrays.stream(partitionColumns)
@@ -56,7 +64,8 @@ public LinkedHashMap generatePartValues(InternalRow in) {
for (int i = 0; i < partitionFieldGetters.length; i++) {
Object field = partitionFieldGetters[i].getFieldOrNull(in);
- String partitionValue = field != null ? field.toString() : null;
+ String partitionValue =
+ TypeUtils.castPartitionValueToString(field, types.get(i), legacyPartitionName);
if (StringUtils.isNullOrWhitespaceOnly(partitionValue)) {
partitionValue = defaultPartValue;
}
diff --git a/paimon-common/src/main/java/org/apache/paimon/utils/TypeUtils.java b/paimon-common/src/main/java/org/apache/paimon/utils/TypeUtils.java
index 8d8d84953da7..046e3d4b3e67 100644
--- a/paimon-common/src/main/java/org/apache/paimon/utils/TypeUtils.java
+++ b/paimon-common/src/main/java/org/apache/paimon/utils/TypeUtils.java
@@ -18,6 +18,8 @@
package org.apache.paimon.utils;
+import org.apache.paimon.casting.CastExecutor;
+import org.apache.paimon.casting.CastExecutors;
import org.apache.paimon.data.BinaryString;
import org.apache.paimon.data.Decimal;
import org.apache.paimon.data.GenericArray;
@@ -88,6 +90,24 @@ public static RowType project(RowType inputType, List names) {
.collect(Collectors.toList()));
}
+ public static String castPartitionValueToString(
+ Object value, DataType type, boolean legacyPartitionName) {
+ if (value == null) {
+ return null;
+ }
+ if (legacyPartitionName) {
+ return value.toString();
+ }
+
+ CastExecutor