Skip to content

Commit

Permalink
Don't fail early when using reference attribute in grouping expression.
Browse files Browse the repository at this point in the history
This is not yet supported in the backend, so it still results in an error in the query result.
This change is done to unblock some failing tests.
  • Loading branch information
geirst committed Dec 13, 2024
1 parent cfa3f3c commit e43e137
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ static private boolean isPrimitiveAttribute(AttributesConfig.Attribute attribute
datatype == AttributesConfig.Attribute.Datatype.DOUBLE;
}

static private boolean isSingleRawOrBoolAttribute(AttributesConfig.Attribute attribute) {
static private boolean isSingleRawBoolOrReferenceAttribute(AttributesConfig.Attribute attribute) {
var datatype = attribute.datatype();
return (datatype == AttributesConfig.Attribute.Datatype.RAW ||
datatype == AttributesConfig.Attribute.Datatype.BOOL) &&
datatype == AttributesConfig.Attribute.Datatype.BOOL ||
datatype == AttributesConfig.Attribute.Datatype.REFERENCE) &&
attribute.collectiontype() == AttributesConfig.Attribute.Collectiontype.SINGLE;
}

Expand All @@ -122,7 +123,7 @@ private void verifyHasAttribute(String attributeName, boolean isMapLookup) {
if (attribute == null) {
throw new UnavailableAttributeException(clusterName, attributeName);
}
if (isPrimitiveAttribute(attribute) || (!isMapLookup && isSingleRawOrBoolAttribute(attribute))) {
if (isPrimitiveAttribute(attribute) || (!isMapLookup && isSingleRawBoolOrReferenceAttribute(attribute))) {
return;
}
throw new IllegalInputException("Grouping request references attribute '" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ void predicate_attribute_throws() {
}

@Test
void reference_attribute_throws() {
unsupported_attribute_type_throws("reference", AttributesConfig.Attribute.Datatype.REFERENCE, "reference");
void reference_attribute_is_ok() {
validate_attribute_type("reference", AttributesConfig.Attribute.Datatype.REFERENCE);
}

@Test
Expand Down

0 comments on commit e43e137

Please sign in to comment.