Skip to content

NH-3800 and NH-3681 #433

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

Merged
merged 1 commit into from
Jun 23, 2015
Merged

NH-3800 and NH-3681 #433

merged 1 commit into from
Jun 23, 2015

Conversation

PleasantD
Copy link
Contributor

Fixes NH-3681 by allowing the GroupBySelectClauseRewriter to correctly match the group by elements.
Fixes NH-3800 by unwrapping constant ArrayIndex expressions to their inner expressions.

if (index == null)
return visitedExpression;

var expressionList = expression.Left as NewArrayExpression;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add check that this is a NewArrayInit and not NewArrayBounds

@hazzik
Copy link
Member

hazzik commented Jun 17, 2015

@PleasantD can you please update the pull request according to CONTRIBUTING.md. Eg, tabs instead of spaces

@hazzik hazzik modified the milestone: 4.1.0 Jun 17, 2015
@PleasantD
Copy link
Contributor Author

Done and done! Is there anything else I can do to expedite the release of this and #432?

@hazzik
Copy link
Member

hazzik commented Jun 18, 2015

@PleasantD

TransparentIdentifierRemovingExpressionTreeVisitor (doing the same as you did with arrays, but for anonymous types) also visits SubQueryExpression, can you investigate, if we need so?

@hazzik
Copy link
Member

hazzik commented Jun 18, 2015

@PleasantD also, can you squash your commits?

@@ -31,7 +31,7 @@ private GroupBySelectClauseRewriter(GroupResultOperator groupBy, QueryModel mode

protected override Expression VisitQuerySourceReferenceExpression(QuerySourceReferenceExpression expression)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to add

            if (!IsMemberOfModel(expression))
            {
                return base.VisitQuerySourceReferenceExpression(expression);
            }

If necessary

- Added issue specific tests
- Modifed the GroupBySelectClauseRewriter to dig a bit deeper to match the group result ElementSelector
- Modifed the GroupBySelectClauseRewriter to allow member access of convert expressions
- Added a step to the QueryModelVisitor to flatten array index expressions with constant indexers to the inner expression
@PleasantD
Copy link
Contributor Author

@hazzik regarding the ArrayIndexExpressionFlattener needing to visit SubQueryExpressions
It seems like it could, but it may not need to.

I wrote an example test and found that the initial pass wasn't flattening the array access, but then QueryModelVisitor.GenerateHqlQuery gets called on the subquery by HqlGeneratorExpressionTreeVisitor, causing the array indexes to be flattened on the second pass.

If the SubQueryExpression query model is flattened by the initial pass, then the same result occurs.

hazzik added a commit that referenced this pull request Jun 23, 2015
NH-3681 - Allow the GroupBySelectClauseRewriter to correctly match the group by elements
NH-3800 - Unwrapping constant ArrayIndex expressions to their inner expressions
@hazzik hazzik merged commit 7a43e33 into nhibernate:master Jun 23, 2015
@PleasantD PleasantD deleted the NH-3800 branch March 6, 2017 21:21
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

Successfully merging this pull request may close these issues.

2 participants