Skip to content

Commit e51f72b

Browse files
authored
[hotfix] Use literal directly instead of PARTITION_GENERATE_LEGCY_NAME to avoid NoSuchField error (apache#1880)
1 parent e69e4f4 commit e51f72b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

fluss-lake/fluss-lake-paimon/src/main/java/org/apache/fluss/lake/paimon/utils/PaimonConversions.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949
/** Utils for conversion between Paimon and Fluss. */
5050
public class PaimonConversions {
5151

52+
// use literal directly, a future paimon version will rename
53+
// the variable PARTITION_GENERATE_LEGCY_NAME to PARTITION_GENERATE_LEGACY_NAME, use literal
54+
// can help avoid NoSuchField error
55+
// todo: after upgrade paimon version, we call fall back to use PARTITION_GENERATE_LEGACY_NAME
56+
// again
57+
private static final String PARTITION_GENERATE_LEGACY_NAME_OPTION_KEY = "partition.legacy-name";
58+
5259
// for fluss config
5360
private static final String FLUSS_CONF_PREFIX = "fluss.";
5461
// for paimon config
@@ -60,7 +67,7 @@ public class PaimonConversions {
6067
static {
6168
PAIMON_UNSETTABLE_OPTIONS.add(CoreOptions.BUCKET.key());
6269
PAIMON_UNSETTABLE_OPTIONS.add(CoreOptions.BUCKET_KEY.key());
63-
PAIMON_UNSETTABLE_OPTIONS.add(CoreOptions.PARTITION_GENERATE_LEGCY_NAME.key());
70+
PAIMON_UNSETTABLE_OPTIONS.add(PARTITION_GENERATE_LEGACY_NAME_OPTION_KEY);
6471
}
6572

6673
public static RowKind toRowKind(ChangeType changeType) {
@@ -219,7 +226,7 @@ private static void validatePaimonOptions(Map<String, String> properties) {
219226
private static void setPaimonDefaultProperties(Options options) {
220227
// set partition.legacy-name to false, otherwise paimon will use toString for all types,
221228
// which will cause inconsistent partition value for the same binary value
222-
options.set(CoreOptions.PARTITION_GENERATE_LEGCY_NAME, false);
229+
options.set(PARTITION_GENERATE_LEGACY_NAME_OPTION_KEY, Boolean.FALSE.toString());
223230
}
224231

225232
private static void setFlussPropertyToPaimon(String key, String value, Options options) {

0 commit comments

Comments
 (0)