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

Query: Exception when using OrderBy and navigation ("A column has been specified more than once in the order by list") #5427

Closed
maumar opened this issue May 19, 2016 · 0 comments
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@maumar
Copy link
Contributor

maumar commented May 19, 2016

QueryNavigationsTest -> Collection_select_nav_prop_first_or_default_then_nav_prop_nested_with_orderby throws

            AssertQuery<Customer, Order, string>(
                (cs, os) => cs.Where(e => e.CustomerID.StartsWith("A"))
                    .Select(c => os.OrderBy(o => o.CustomerID).FirstOrDefault(oo =>oo.CustomerID == "ALFKI").Customer.City));

Exception:
System.Data.SqlClient.SqlException : A column has been specified more than once in the order by list. Columns in the order by list must be unique.

query plan:

TRACKED: False
(QueryContext queryContext) => IEnumerable<string> _Select(
    source: IEnumerable<ValueBuffer> _ShapedQuery(
        queryContext: queryContext, 
        shaperCommandContext: SelectExpression: 
            SELECT 1
            FROM [Customers] AS [e]
            WHERE [e].[CustomerID] LIKE N'A' + N'%'
        , 
        shaper: ValueBufferShaper
    )
    , 
    selector: (ValueBuffer e) => string FirstOrDefault(
        source: IEnumerable<string> _Select(
            source: IEnumerable<TransparentIdentifier<TransparentIdentifier<Order, IEnumerable<Customer>>, Customer>> _SelectMany(
                source: IEnumerable<TransparentIdentifier<Order, IEnumerable<Customer>>> _GroupJoin(
                    queryContext: (RelationalQueryContext) queryContext, 
                    source: IEnumerable<ValueBuffer> _Query(
                        queryContext: queryContext, 
                        shaperCommandContext: SelectExpression: 
                            SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o.Customer].[CustomerID], [o.Customer].[Address], [o.Customer].[City], [o.Customer].[CompanyName], [o.Customer].[ContactName], [o.Customer].[ContactTitle], [o.Customer].[Country], [o.Customer].[Fax], [o.Customer].[Phone], [o.Customer].[PostalCode], [o.Customer].[Region]
                            FROM [Orders] AS [o]
                            LEFT JOIN [Customers] AS [o.Customer] ON [o].[CustomerID] = [o.Customer].[CustomerID]
                            WHERE [o].[CustomerID] = N'ALFKI'
                            ORDER BY [o].[CustomerID], [o].[CustomerID]
                        , 
                        queryIndex: default(System.Nullable`1[System.Int32])
                    )
                    , 
                    outerShaper: BufferedEntityShaper<Order>, 
                    innerShaper: BufferedOffsetEntityShaper<Customer>, 
                    innerKeySelector: (Customer o.Customer) => string GetValue(
                        queryContext: queryContext, 
                        entity: o.Customer, 
                        property: CustomerID
                    )
                    , 
                    resultSelector: (Order o | IEnumerable<Customer> o.Customer_group) => TransparentIdentifier<Order, IEnumerable<Customer>> CreateTransparentIdentifier(
                        outer: o, 
                        inner: o.Customer_group
                    )
                    , 
                    outerGroupJoinInclude: default(Internal.GroupJoinInclude), 
                    innerGroupJoinInclude: default(Internal.GroupJoinInclude)
                )
                , 
                collectionSelector: (TransparentIdentifier<Order, IEnumerable<Customer>> t0) => IEnumerable<Customer> DefaultIfEmpty(
                    source: t0.Inner
                )
                , 
                resultSelector: (TransparentIdentifier<Order, IEnumerable<Customer>> t0 | Customer o.Customer) => TransparentIdentifier<TransparentIdentifier<Order, IEnumerable<Customer>>, Customer> CreateTransparentIdentifier(
                    outer: t0, 
                    inner: o.Customer
                )
            )
            , 
            selector: (TransparentIdentifier<TransparentIdentifier<Order, IEnumerable<Customer>>, Customer> t1) => t1.Inner.City
        )
    )
)
@maumar maumar changed the title Query :: bug template Query :: A column has been specified more than once in the order by list thrown for a complex query with orderby and navigation May 19, 2016
@rowanmiller rowanmiller added this to the 1.0.1 milestone May 23, 2016
anpete added a commit that referenced this issue Jun 30, 2016
Fix: #3676 - Usage of the "let" keyword breaks grouping.
 - Fixed compiler bug in tracked, grouped queries.
Fix: #5427 - A column has been specified more than once in the order by list thrown for a complex query with orderby and navigation.
 - Fixed bug in SelectExpression.PrependToOrderBy
Fix: #4539 - Query :: Join flattening fails for some complex cases involving SelectMany
 - SelectMany after GroupJoin should not cause client-eval.

Also addressed most of the R# warnings in nav. rewriter.
anpete added a commit that referenced this issue Jun 30, 2016
Fix: #3676 - Usage of the "let" keyword breaks grouping.
 - Fixed compiler bug in tracked, grouped queries.
Fix: #5427 - A column has been specified more than once in the order by list thrown for a complex query with orderby and navigation.
 - Fixed bug in SelectExpression.PrependToOrderBy
Fix: #4539 - Query :: Join flattening fails for some complex cases involving SelectMany
 - SelectMany after GroupJoin should not cause client-eval.

Also addressed most of the R# warnings in nav. rewriter.
anpete added a commit that referenced this issue Jun 30, 2016
Fix: #3676 - Usage of the "let" keyword breaks grouping.
 - Fixed compiler bug in tracked, grouped queries.
Fix: #5427 - A column has been specified more than once in the order by list thrown for a complex query with orderby and navigation.
 - Fixed bug in SelectExpression.PrependToOrderBy
Fix: #4539 - Query :: Join flattening fails for some complex cases involving SelectMany
 - SelectMany after GroupJoin should not cause client-eval.

Also addressed most of the R# warnings in nav. rewriter.
@rowanmiller rowanmiller modified the milestones: 1.0.1, 1.1.0 Jul 1, 2016
anpete added a commit that referenced this issue Jul 1, 2016
Fix: #3676 - Usage of the "let" keyword breaks grouping.
 - Fixed compiler bug in tracked, grouped queries.
Fix: #5427 - A column has been specified more than once in the order by list thrown for a complex query with orderby and navigation.
 - Fixed bug in SelectExpression.PrependToOrderBy
Fix: #4539 - Query :: Join flattening fails for some complex cases involving SelectMany
 - SelectMany after GroupJoin should not cause client-eval.

Also addressed most of the R# warnings in nav. rewriter.
anpete added a commit that referenced this issue Jul 3, 2016
Fix: #3676 - Usage of the "let" keyword breaks grouping.
 - Fixed compiler bug in tracked, grouped queries.
Fix: #5427 - A column has been specified more than once in the order by list thrown for a complex query with orderby and navigation.
 - Fixed bug in SelectExpression.PrependToOrderBy
Fix: #4539 - Query :: Join flattening fails for some complex cases involving SelectMany
 - SelectMany after GroupJoin should not cause client-eval.

Also addressed most of the R# warnings in nav. rewriter.
@anpete anpete closed this as completed in bd1aa14 Jul 4, 2016
@anpete anpete added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jul 8, 2016
@anpete anpete removed their assignment Jul 8, 2016
@rowanmiller rowanmiller changed the title Query :: A column has been specified more than once in the order by list thrown for a complex query with orderby and navigation Query: Exception when using orderby and navigation ("A column has been specified more than once in the order by list") Jul 21, 2016
@divega divega changed the title Query: Exception when using orderby and navigation ("A column has been specified more than once in the order by list") Query: Exception when using OrderBy and navigation ("A column has been specified more than once in the order by list") Sep 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

4 participants