Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aggregation not supported for dynamic properties #760

Closed
kosinsky opened this issue Feb 15, 2017 · 4 comments
Closed

aggregation not supported for dynamic properties #760

kosinsky opened this issue Feb 15, 2017 · 4 comments

Comments

@kosinsky
Copy link
Contributor

Create OData endpoint for Items entity defined as

    public class Item
    {
        [Key]
        public int ItemId { get; set; }
// other properties
        public IDictionary<string, object> 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

@kosinsky kosinsky changed the title aggregation isn't supported for dynamic properties aggregation not supported for dynamic properties Feb 15, 2017
@robward-ms
Copy link
Contributor

Merged, fixed.

@robward-ms
Copy link
Contributor

Need port of #813 to 7.x

@kosinsky
Copy link
Contributor Author

Port to 7.x #816

xuzhg pushed a commit that referenced this issue Jun 8, 2017
@xuzhg
Copy link
Member

xuzhg commented Jun 8, 2017

Fixed at: 88bd1a8

Thanks, and please let us know any problem.

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

No branches or pull requests

3 participants