Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Yingjian Wu committed Apr 14, 2024
1 parent 830fc4f commit 483451d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,18 @@ Type getCanonicalType(final TypeInfo typeInfo) {
case STRUCT:
final StructTypeInfo structTypeInfo =
TypeUtils.checkType(typeInfo, StructTypeInfo.class, "typeInfo");
final List<TypeSignature> fieldTypes = new ArrayList<>();
final List<Object> fieldNames = new ArrayList<>();
for (String fieldName : structTypeInfo.getAllStructFieldNames()) {
fieldNames.add(fieldName);
final Type fieldType = getCanonicalType(structTypeInfo.getStructFieldTypeInfo(fieldName));
// Hive struct type infos
final List<String> structFieldNames = structTypeInfo.getAllStructFieldNames();
final List<TypeInfo> structFieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();
int structInfoCounts = structFieldNames.size();

// Metacat canonical type infos
final List<TypeSignature> fieldTypes = new ArrayList<>(structInfoCounts);
final List<Object> fieldNames = new ArrayList<>(structInfoCounts);

for (int i = 0; i < structInfoCounts; i++) {
fieldNames.add(structFieldNames.get(i));
final Type fieldType = getCanonicalType(structFieldTypeInfos.get(i));
if (fieldType == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ class MetacatSmokeSpec extends Specification {
]
}
"""
assert nestedFieldDto.jsonType.toPrettyString() == expectedJsonString
cleanup:
api.deleteTable(catalogName, databaseName, tableName)
}
Expand Down

0 comments on commit 483451d

Please sign in to comment.