Skip to content

Commit

Permalink
fix missing returnType issue, add more testing
Browse files Browse the repository at this point in the history
  • Loading branch information
stephaniewang526 committed Feb 9, 2021
1 parent 07a923b commit 11897a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Expand Up @@ -433,7 +433,6 @@ Routine toPb() {
new Routine()
.setEtag(getEtag())
.setRoutineType(getRoutineType())
.setReturnType(getReturnType().toPb())
.setDefinitionBody(getBody())
.setCreationTime(getCreationTime())
.setDescription(getDescription())
Expand All @@ -446,6 +445,9 @@ Routine toPb() {
if (getArguments() != null) {
routinePb.setArguments(Lists.transform(getArguments(), RoutineArgument.TO_PB_FUNCTION));
}
if (getReturnType() != null) {
routinePb.setReturnType(getReturnType().toPb());
}
return routinePb;
}

Expand Down
Expand Up @@ -29,6 +29,7 @@ public class RoutineInfoTest {
private static final String ROUTINE_TYPE = "SCALAR_FUNCTION";
private static final Long CREATION_TIME = 10L;
private static final String DESCRIPTION = "description";
private static final String DETERMINISM = "DETERMINISTIC";
private static final Long LAST_MODIFIED_TIME = 20L;
private static final String LANGUAGE = "SQL";

Expand All @@ -55,6 +56,7 @@ public class RoutineInfoTest {
.setRoutineType(ROUTINE_TYPE)
.setCreationTime(CREATION_TIME)
.setDescription(DESCRIPTION)
.setDeterminismLevel(DETERMINISM)
.setLastModifiedTime(LAST_MODIFIED_TIME)
.setLanguage(LANGUAGE)
.setArguments(ARGUMENT_LIST)
Expand All @@ -71,7 +73,8 @@ public void testToBuilder() {
@Test
public void testBuilderIncomplete() {
RoutineInfo routineInfo = RoutineInfo.of(ROUTINE_ID);
assertEquals(routineInfo, routineInfo.toBuilder().build());
RoutineInfo expected = routineInfo.toBuilder().build();
assertEquals(routineInfo, expected);
}

@Test
Expand All @@ -81,6 +84,7 @@ public void testBuilder() {
assertEquals(ROUTINE_TYPE, ROUTINE_INFO.getRoutineType());
assertEquals(CREATION_TIME, ROUTINE_INFO.getCreationTime());
assertEquals(DESCRIPTION, ROUTINE_INFO.getDescription());
assertEquals(DETERMINISM, ROUTINE_INFO.getDeterminismLevel());
assertEquals(LAST_MODIFIED_TIME, ROUTINE_INFO.getLastModifiedTime());
assertEquals(LANGUAGE, ROUTINE_INFO.getLanguage());
assertEquals(ARGUMENT_LIST, ROUTINE_INFO.getArguments());
Expand All @@ -97,6 +101,7 @@ public void testOf() {
assertNull(routineInfo.getRoutineType());
assertNull(routineInfo.getCreationTime());
assertNull(routineInfo.getDescription());
assertNull(routineInfo.getDeterminismLevel());
assertNull(routineInfo.getLastModifiedTime());
assertNull(routineInfo.getLanguage());
assertNull(routineInfo.getArguments());
Expand All @@ -121,6 +126,7 @@ public void compareRoutineInfo(RoutineInfo expected, RoutineInfo value) {
assertEquals(expected.getRoutineType(), value.getRoutineType());
assertEquals(expected.getCreationTime(), value.getCreationTime());
assertEquals(expected.getDescription(), value.getDescription());
assertEquals(expected.getDeterminismLevel(), value.getDeterminismLevel());
assertEquals(expected.getLastModifiedTime(), value.getLastModifiedTime());
assertEquals(expected.getLanguage(), value.getLanguage());
assertEquals(expected.getArguments(), value.getArguments());
Expand Down

0 comments on commit 11897a0

Please sign in to comment.