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

Fixed issue with previous checkin (#430) where binary type was returning null for attribute jsonType. #432

Merged
merged 1 commit into from
Apr 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.netflix.metacat.common.type.RowType;
import com.netflix.metacat.common.type.Type;
import com.netflix.metacat.common.type.TypeEnum;
import com.netflix.metacat.common.type.VarbinaryType;
import com.netflix.metacat.common.type.VarcharType;

/**
Expand Down Expand Up @@ -67,7 +68,8 @@ default JsonNode fromMetacatTypeToJson(Type type) {
final TypeEnum base = type.getTypeSignature().getBase();
if (!base.isParametricType()) {
result = new TextNode(fromMetacatType(type));
} else if (type instanceof DecimalType || type instanceof CharType || type instanceof VarcharType) {
} else if (type instanceof DecimalType || type instanceof CharType
|| type instanceof VarcharType || type instanceof VarbinaryType) {
final ObjectNode node = json.emptyObjectNode();
final String typeText = fromMetacatType(type);
final int index = typeText.indexOf('(');
Expand All @@ -80,8 +82,10 @@ default JsonNode fromMetacatTypeToJson(Type type) {
node.put("scale", ((DecimalType) type).getScale());
} else if (type instanceof CharType) {
node.put("length", ((CharType) type).getLength());
} else {
} else if (type instanceof VarcharType) {
node.put("length", ((VarcharType) type).getLength());
} else {
node.put("length", ((VarbinaryType) type).getLength());
}
}
result = node;
Expand Down