Skip to content

Commit

Permalink
[CALCITE-4409] Improve exception when RelBuilder tries to create a fi…
Browse files Browse the repository at this point in the history
…eld on a non-struct expression
  • Loading branch information
rubenada committed Nov 25, 2020
1 parent 367181d commit 0ad1bc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -80,8 +80,8 @@ protected RelDataTypeImpl() {
@Override public RelDataTypeField getField(String fieldName, boolean caseSensitive,
boolean elideRecord) {
if (fieldList == null) {
throw new IllegalStateException("The current type " + this
+ " does not support named field lookup, so field " + fieldName + " cannot be located");
throw new IllegalStateException("Trying to access field " + fieldName
+ " in a type with no fields: " + this);
}
for (RelDataTypeField field : fieldList) {
if (Util.matches(caseSensitive, field.getName(), fieldName)) {
Expand Down
Expand Up @@ -2589,8 +2589,8 @@ private RelNode buildRelWithDuplicateAggregates(
.build();
}, "Field should fail since we are trying access a field on expression with non-struct type");
assertThat(ex.getMessage(),
allOf(containsString("The current type"),
containsString("does not support named field lookup")));
allOf(containsString("Trying to access field"),
containsString("in a type with no fields")));
}

@Test void testMultiLevelAlias() {
Expand Down

0 comments on commit 0ad1bc4

Please sign in to comment.