Skip to content

Commit

Permalink
Fix Bad error message for invalid type
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenxiao authored and cberner committed Mar 2, 2015
1 parent a9537eb commit 5fa45a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ private Type instantiateParametricType(TypeSignature signature)
{
ImmutableList.Builder<Type> parameterTypes = ImmutableList.builder();
for (TypeSignature parameter : signature.getParameters()) {
parameterTypes.add(getType(parameter));
Type parameterType = getType(parameter);
if (parameterType == null) {
return null;
}
parameterTypes.add(parameterType);
}

ParametricType parametricType = parametricTypes.get(signature.getBase().toLowerCase(Locale.ENGLISH));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3489,6 +3489,12 @@ public void testTypeMismatch()
computeActual("SELECT 1 <> 'x'");
}

@Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = "\\QUnknown type: ARRAY<FOO>\\E")
public void testInvalidType()
{
computeActual("select cast(null as array<foo>)");
}

@Test
public void testTimeLiterals()
throws Exception
Expand Down

0 comments on commit 5fa45a9

Please sign in to comment.