Skip to content

Query: Improvements to Relational GroupBy translation for composition - #11222

Merged
smitpatel merged 1 commit into
devfrom
smit/groupbystreamlined
Mar 14, 2018
Merged

smitpatel merged 1 commit into
devfrom
smit/groupbystreamlined

Conversation

@smitpatel

@smitpatel smitpatel commented Mar 10, 2018 •

Copy link
Copy Markdown
Contributor

Query: Improvements to Relational GroupBy translation for composition

Part of #10012
Part of #2341

@smitpatel
smitpatel requested review from anpete and maumar March 10, 2018 01:30
@smitpatel
smitpatel force-pushed the smit/groupbystreamlined branch from 76df74f to b95111c Compare March 13, 2018 23:09
@smitpatel smitpatel changed the title [WIP] Query: Improvements to Relational GroupBy translation for composition Query: Improvements to Relational GroupBy translation for composition Mar 13, 2018
@smitpatel

Copy link
Copy Markdown
Contributor Author

Ping!

/// <value>
/// The predicate.
/// </value>
public virtual Expression HavingExpression { get; [param: CanBeNull] set; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Having

@smitpatel
smitpatel force-pushed the smit/groupbystreamlined branch from b95111c to 2a1c7b1 Compare March 14, 2018 01:27
@smitpatel

Copy link
Copy Markdown
Contributor Author

Updated to translate group by constant/parameter. Ready for review.

@smitpatel
smitpatel force-pushed the smit/groupbystreamlined branch from 2a1c7b1 to e8ca357 Compare March 14, 2018 01:31
@"SELECT [o].[CustomerID] AS [Key], COUNT(*) AS [Count]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
HAVING COUNT(*) > 4");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎉

return translatedKey;
}

goto default;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can the default block be moved after the switch?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. Would it matter though?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code would be more standard. n-dev problem :trollface:

private Expression TryBindQuerySourcePropertyExpression(MemberExpression memberExpression)
{
if (memberExpression.Expression is QuerySourceReferenceExpression qsre)
if (!(memberExpression.Expression is QuerySourceReferenceExpression qsre))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Flip condition?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Flipping condition wouldn't avoid nesting. First if block retrieves the QSRE in multiple cases. Second if block uses QSRE to find the translation.

@smitpatel
smitpatel force-pushed the smit/groupbystreamlined branch from e8ca357 to 6cf774e Compare March 14, 2018 17:25
- Add support for translating OrderBy after GroupBy operator
- Add support for `HAVING` clause in SQL which would be generated when translating predicate after GroupByAggregate Resolves #10870
- Make sure client eval warning is not issued when translating GroupByAggregate Resolves #11157
- GroupBy Aggregate works when element/result selector is DTO instead of anonymous type Resolves #11176 (KeySelector has to be client evaluated)
- Make sure that SQL added to GROUP BY clause is not aliased Resolves #11218
- Translate GroupBy Constant/Parameter with aggregates Resolves #9969

Part of #10012
Part of #2341
@smitpatel
smitpatel force-pushed the smit/groupbystreamlined branch from 6cf774e to 5b6e178 Compare March 14, 2018 17:26
@smitpatel
smitpatel merged commit 5b6e178 into dev Mar 14, 2018
@smitpatel
smitpatel deleted the smit/groupbystreamlined branch March 14, 2018 17:51
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.

3 participants