Skip to content

aggregation not supported for dynamic properties #760

Description

@kosinsky

Create OData endpoint for Items entity defined as

    public class Item
    {
        [Key]
        public int ItemId { get; set; }
// other properties
        public IDictionary DynamicProperties { get; set; }
    }

Try to run query Items?$apply=aggregate(I with max as MaxId) where I is dynamic property.
It will fail with ArgumentNull exception:

at Microsoft.OData.ExceptionUtils.CheckArgumentNotNull[T](T value, String parameterName)
at Microsoft.OData.UriParser.Aggregation.AggregateExpression..ctor(SingleValueNode expression, AggregationMethod method, String alias, IEdmTypeReference typeReference)
at Microsoft.OData.UriParser.Aggregation.ApplyBinder.BindAggregateExpressionToken(AggregateExpressionToken token)
at Microsoft.OData.UriParser.Aggregation.ApplyBinder.BindAggregateToken(AggregateToken token)
at Microsoft.OData.UriParser.Aggregation.ApplyBinder.BindApply(IEnumerable`1 tokens)
at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseApplyImplementation(String apply, ODataUriParserConfiguration configuration, ODataPathInfo odataPathInfo)
at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseApply()
at System.Web.OData.Query.ApplyQueryOption.get_ApplyClause()

Assemblies affected

OData .Net lib 6.15.* OData .Net lib 7.0.*

Additional details

Reason is that for SingleValueOpenPropertyAccessNode TypeReference is null, but AggregateExpression expects not null

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions