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

Aliases created in compute transformation aren't visible for later transformations or query options #1368

Closed
kosinsky opened this issue Jan 2, 2019 · 1 comment
Milestone

Comments

@kosinsky
Copy link
Contributor

kosinsky commented Jan 2, 2019

Queries like:
$apply=aggregate(FavoriteNumber with sum as Total)/compute(Total mul 2 as DoubleTotal)&$orderby=DoubleTotal asc

$apply=aggregate(FavoriteNumber with sum as Total)/compute(Total mul 2 as DoubleTotal1)/compute(DoubleTotal1 mul 2 as DoubleTotal2)"
fail with DoubleTotal(1) property not found

Assemblies affected

7.5+

Reproduce steps

    [Fact]
    public void AggregatedAndComputePropertiesTreatedAsOpenPropertyInOrderBy()
    {
        var odataQueryOptionParser = new ODataQueryOptionParser(HardCodedTestModel.TestModel,
            HardCodedTestModel.GetPersonType(), HardCodedTestModel.GetPeopleSet(),
            new Dictionary<string, string>()
            {
                {"$orderby", "DoubleTotal asc, Total desc"},
                {"$apply", "aggregate(FavoriteNumber with sum as Total)/compute(Total mul 2 as DoubleTotal)"}
            });
        odataQueryOptionParser.ParseApply();
        var orderByClause = odataQueryOptionParser.ParseOrderBy();
        orderByClause.Direction.Should().Be(OrderByDirection.Ascending);
        orderByClause.Expression.ShouldBeSingleValueOpenPropertyAccessQueryNode("DoubleTotal");
        orderByClause = orderByClause.ThenBy;
        orderByClause.Direction.Should().Be(OrderByDirection.Descending);
        orderByClause.Expression.ShouldBeSingleValueOpenPropertyAccessQueryNode("Total");
    }

Expected result

Test should pass

Actual result

Test fails with property not found exception.

@xuzhg
Copy link
Member

xuzhg commented Feb 14, 2019

It was merged. close it.

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

No branches or pull requests

3 participants