Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] [seatunnel-formats] Allow the entry in the map to be null and allow the key in the entry to be null #5277

Merged
merged 7 commits into from
Sep 11, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,13 @@ private Object convert(String field, SeaTunnelDataType<?> fieldType, int level)
String[] kvs = field.split(separators[level + 1]);
for (String kv : kvs) {
String[] splits = kv.split(separators[level + 2]);
objectMap.put(
convert(splits[0], keyType, level + 1),
convert(splits[1], valueType, level + 1));
if (splits.length < 2) {
objectMap.put(convert(splits[0], keyType, level + 1), null);
} else {
objectMap.put(
convert(splits[0], keyType, level + 1),
convert(splits[1], valueType, level + 1));
}
}
return objectMap;
case STRING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ public class TextFormatSchemaTest {
+ '\002'
+ "Kris"
+ '\003'
+ "21\001"
+ "21"
+ '\002'
+ "nullValueKey"
+ '\003'
+ '\002'
+ '\003'
+ "1231"
+ "\001"
+ "tyrantlucifer\001"
+ "true\001"
+ "1\001"
Expand Down