DBZ-612 Support mongo NULL type
Since we can't trace back the original value since mongo is a schema-less storage we fallback to string as strategy.
This commit is contained in:
parent
c5ecff4be6
commit
6e115043ca
@ -51,12 +51,12 @@ public void convertFieldValue(Entry<String, BsonValue> keyvalueforStruct, Struct
|
||||
String key = keyvalueforStruct.getKey();
|
||||
BsonType type = keyvalueforStruct.getValue().getBsonType();
|
||||
|
||||
if (type == BsonType.NULL) {
|
||||
LOG.warn("Field of type NULL is not added to the struct");
|
||||
return;
|
||||
}
|
||||
switch (type) {
|
||||
|
||||
case NULL:
|
||||
colValue = null;
|
||||
break;
|
||||
|
||||
case STRING:
|
||||
colValue = keyvalueforStruct.getValue().asString().getValue().toString();
|
||||
break;
|
||||
@ -233,9 +233,6 @@ public void addFieldSchema(Entry<String, BsonValue> keyValuesforSchema, SchemaBu
|
||||
switch (type) {
|
||||
|
||||
case NULL:
|
||||
LOG.warn("Data type {} not currently supported", type);
|
||||
break;
|
||||
|
||||
case STRING:
|
||||
case JAVASCRIPT:
|
||||
case OBJECT_ID:
|
||||
@ -321,9 +318,6 @@ public void addFieldSchema(Entry<String, BsonValue> keyValuesforSchema, SchemaBu
|
||||
|
||||
switch (valueType) {
|
||||
case NULL:
|
||||
LOG.warn("Data type {} not currently supported", valueType);
|
||||
break;
|
||||
|
||||
case STRING:
|
||||
case JAVASCRIPT:
|
||||
case OBJECT_ID:
|
||||
|
@ -158,6 +158,7 @@ public void shouldProcessNullValue() {
|
||||
SchemaBuilder.struct().name("withnull")
|
||||
.field("_id", Schema.OPTIONAL_STRING_SCHEMA)
|
||||
.field("delivery", SchemaBuilder.struct().name("withnull.delivery").optional()
|
||||
.field("hour", Schema.OPTIONAL_STRING_SCHEMA)
|
||||
.field("hourId", Schema.OPTIONAL_INT32_SCHEMA)
|
||||
.build()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user