Skip to content

Commit

Permalink
Merge branch 'string_split' of https://github.com/MarkMpn/Sql4Cds int…
Browse files Browse the repository at this point in the history
…o string_split
  • Loading branch information
MarkMpn committed Jul 25, 2024
2 parents da02945 + a385447 commit b2e246f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
16 changes: 8 additions & 8 deletions MarkMpn.Sql4Cds.Engine.Tests/ExecutionPlanTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ public void GroupByDatePart()
AssertFetchXml(aggregateFetch, @"
<fetch aggregate='true'>
<entity name='account'>
<attribute name='createdon' groupby='true' alias='createdon_month' dategrouping='month' />
<attribute name='createdon' groupby='true' alias='createdon_month' dategrouping='month' usertimezone='true' />
<attribute name='accountid' aggregate='count' alias='count' />
<order alias='createdon_month' />
</entity>
Expand All @@ -791,7 +791,7 @@ public void GroupByDatePart()
AssertFetchXml(partitionFetch, @"
<fetch aggregate='true'>
<entity name='account'>
<attribute name='createdon' groupby='true' alias='createdon_month' dategrouping='month' />
<attribute name='createdon' groupby='true' alias='createdon_month' dategrouping='month' usertimezone='true' />
<attribute name='accountid' aggregate='count' alias='count' />
<order alias='createdon_month' />
</entity>
Expand Down Expand Up @@ -844,9 +844,9 @@ GROUP BY
AssertFetchXml(aggregateFetch, @"
<fetch aggregate='true'>
<entity name='account'>
<attribute name='createdon' groupby='true' alias='createdon_year' dategrouping='year' />
<attribute name='createdon' groupby='true' alias='createdon_month' dategrouping='month' />
<attribute name='createdon' groupby='true' alias='createdon_day' dategrouping='day' />
<attribute name='createdon' groupby='true' alias='createdon_year' dategrouping='year' usertimezone='true' />
<attribute name='createdon' groupby='true' alias='createdon_month' dategrouping='month' usertimezone='true' />
<attribute name='createdon' groupby='true' alias='createdon_day' dategrouping='day' usertimezone='true' />
<attribute name='accountid' aggregate='count' alias='count' />
<order alias='createdon_year' />
<order alias='createdon_month' />
Expand All @@ -862,9 +862,9 @@ GROUP BY
AssertFetchXml(partitionFetch, @"
<fetch aggregate='true'>
<entity name='account'>
<attribute name='createdon' groupby='true' alias='createdon_year' dategrouping='year' />
<attribute name='createdon' groupby='true' alias='createdon_month' dategrouping='month' />
<attribute name='createdon' groupby='true' alias='createdon_day' dategrouping='day' />
<attribute name='createdon' groupby='true' alias='createdon_year' dategrouping='year' usertimezone='true' />
<attribute name='createdon' groupby='true' alias='createdon_month' dategrouping='month' usertimezone='true' />
<attribute name='createdon' groupby='true' alias='createdon_day' dategrouping='day' usertimezone='true' />
<attribute name='accountid' aggregate='count' alias='count' />
<order alias='createdon_year' />
<order alias='createdon_month' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,6 @@ Source is FetchXmlScan fetch &&
canUseFetchXmlAggregate = false;
break;
}

// FetchXML dategrouping always uses local timezone. If we're using UTC we can't use it
if (!context.Options.UseLocalTimeZone)
{
canUseFetchXmlAggregate = false;
break;
}
}
}

Expand Down Expand Up @@ -411,6 +404,8 @@ Source is FetchXmlScan fetch &&
{
attribute.dategrouping = dateGrouping.Value;
attribute.dategroupingSpecified = true;
attribute.usertimezone = context.Options.UseLocalTimeZone ? FetchBoolType.@true : FetchBoolType.@false;
attribute.usertimezoneSpecified = true;
}
else if (grouping.GetType(expressionCompilationContext, out _) == typeof(SqlDateTime))
{
Expand Down

0 comments on commit b2e246f

Please sign in to comment.