Skip to content

Commit 2cf608e

Browse files
committed
fix comments
1 parent 083ab22 commit 2cf608e

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

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

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,10 @@ public class PaimonConversions {
5757
/** Paimon config options set by Fluss should not be set by users. */
5858
@VisibleForTesting public static final Set<String> PAIMON_UNSETTABLE_OPTIONS = new HashSet<>();
5959

60-
@VisibleForTesting public static final Options PAIMON_DEFAULT_OPTIONS = new Options();
61-
6260
static {
6361
PAIMON_UNSETTABLE_OPTIONS.add(CoreOptions.BUCKET.key());
6462
PAIMON_UNSETTABLE_OPTIONS.add(CoreOptions.BUCKET_KEY.key());
65-
PAIMON_UNSETTABLE_OPTIONS.add(CoreOptions.CHANGELOG_PRODUCER.key());
66-
67-
// set partition.legacy-name to false, otherwise paimon will use toString for all types,
68-
// which will cause inconsistent partition value for a same binary value
69-
PAIMON_DEFAULT_OPTIONS.set(CoreOptions.PARTITION_GENERATE_LEGCY_NAME, false);
63+
PAIMON_UNSETTABLE_OPTIONS.add(CoreOptions.PARTITION_GENERATE_LEGCY_NAME.key());
7064
}
7165

7266
public static RowKind toRowKind(ChangeType changeType) {
@@ -120,13 +114,13 @@ public static List<SchemaChange> toPaimonSchemaChanges(List<TableChange> tableCh
120114
TableChange.SetOption setOption = (TableChange.SetOption) tableChange;
121115
schemaChanges.add(
122116
SchemaChange.setOption(
123-
getFlussPropertyKeyToPaimon(setOption.getKey()),
117+
convertFlussPropertyKeyToPaimon(setOption.getKey()),
124118
setOption.getValue()));
125119
} else if (tableChange instanceof TableChange.ResetOption) {
126120
TableChange.ResetOption resetOption = (TableChange.ResetOption) tableChange;
127121
schemaChanges.add(
128122
SchemaChange.removeOption(
129-
getFlussPropertyKeyToPaimon(resetOption.getKey())));
123+
convertFlussPropertyKeyToPaimon(resetOption.getKey())));
130124
} else {
131125
throw new UnsupportedOperationException(
132126
"Unsupported table change: " + tableChange.getClass());
@@ -212,19 +206,20 @@ private static void validatePaimonOptions(Map<String, String> properties) {
212206
if (k.startsWith(PAIMON_CONF_PREFIX)) {
213207
paimonKey = k.substring(PAIMON_CONF_PREFIX.length());
214208
}
215-
if (PAIMON_UNSETTABLE_OPTIONS.contains(paimonKey)
216-
|| PAIMON_DEFAULT_OPTIONS.toMap().containsKey(paimonKey)) {
209+
if (PAIMON_UNSETTABLE_OPTIONS.contains(paimonKey)) {
217210
throw new InvalidConfigException(
218211
String.format(
219212
"The Paimon option %s will be set automatically by Fluss "
220-
+ "and should not set manually.",
213+
+ "and should not be set manually.",
221214
k));
222215
}
223216
});
224217
}
225218

226219
private static void setPaimonDefaultProperties(Options options) {
227-
PAIMON_DEFAULT_OPTIONS.toMap().forEach(options::set);
220+
// set partition.legacy-name to false, otherwise paimon will use toString for all types,
221+
// which will cause inconsistent partition value for the same binary value
222+
options.set(CoreOptions.PARTITION_GENERATE_LEGCY_NAME, false);
228223
}
229224

230225
private static void setFlussPropertyToPaimon(String key, String value, Options options) {
@@ -235,7 +230,7 @@ private static void setFlussPropertyToPaimon(String key, String value, Options o
235230
}
236231
}
237232

238-
private static String getFlussPropertyKeyToPaimon(String key) {
233+
private static String convertFlussPropertyKeyToPaimon(String key) {
239234
if (key.startsWith(PAIMON_CONF_PREFIX)) {
240235
return key.substring(PAIMON_CONF_PREFIX.length());
241236
} else {

fluss-lake/fluss-lake-paimon/src/test/java/org/apache/fluss/lake/paimon/LakeEnabledTableCreateITCase.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,10 @@
5353
import java.util.Arrays;
5454
import java.util.Collections;
5555
import java.util.HashMap;
56-
import java.util.HashSet;
5756
import java.util.List;
5857
import java.util.Map;
59-
import java.util.Set;
6058
import java.util.stream.Stream;
6159

62-
import static org.apache.fluss.lake.paimon.utils.PaimonConversions.PAIMON_DEFAULT_OPTIONS;
6360
import static org.apache.fluss.lake.paimon.utils.PaimonConversions.PAIMON_UNSETTABLE_OPTIONS;
6461
import static org.apache.fluss.metadata.TableDescriptor.BUCKET_COLUMN_NAME;
6562
import static org.apache.fluss.metadata.TableDescriptor.OFFSET_COLUMN_NAME;
@@ -378,10 +375,7 @@ void testCreateLakeEnabledTableWithAllTypes() throws Exception {
378375
void testCreateLakeEnableTableWithUnsettablePaimonOptions() {
379376
Map<String, String> customProperties = new HashMap<>();
380377

381-
Set<String> keys = new HashSet<>();
382-
keys.addAll(PAIMON_UNSETTABLE_OPTIONS);
383-
keys.addAll(PAIMON_DEFAULT_OPTIONS.keySet());
384-
for (String key : keys) {
378+
for (String key : PAIMON_UNSETTABLE_OPTIONS) {
385379
customProperties.clear();
386380
customProperties.put(key, "v");
387381

@@ -402,7 +396,7 @@ void testCreateLakeEnableTableWithUnsettablePaimonOptions() {
402396
.isInstanceOf(InvalidConfigException.class)
403397
.hasMessage(
404398
String.format(
405-
"The Paimon option %s will be set automatically by Fluss and should not set manually.",
399+
"The Paimon option %s will be set automatically by Fluss and should not be set manually.",
406400
key));
407401
}
408402
}

0 commit comments

Comments
 (0)