Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,28 @@

<!-- put obj files in a mirror tree off the root to keep the src folder tree cleaner -->
<BaseIntermediateOutputPath Condition=" '$(BaseIntermediateOutputPath)' == '' ">$(EnlistmentRoot)\obj\$([MSBuild]::MakeRelative('$(EnlistmentRoot)\', $(MSBuildProjectDirectory)))</BaseIntermediateOutputPath>

<AntlrSourceUrl>https://www.antlr2.org/download/antlr-2.7.5.exe</AntlrSourceUrl>
<AntlrLocation>$(BaseIntermediateOutputPath)\antlr-2.7.5.exe</AntlrLocation>
</PropertyGroup>

<!-- Don't enable localization when we are inside VS -->
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)'=='true'">
<EnableLocalization>false</EnableLocalization>
</PropertyGroup>

<!-- Localization is not enabled by default. Pass /p:EnableLocalization=true to override that.
For some details, see: https://ceapex.visualstudio.com/CEINTL/_wiki/wikis/CEINTL.wiki/341/Localization-in-MSBuild-Retail
-->
<PropertyGroup>
<EnableLocalization Condition="'$(EnableLocalization)' == ''">false</EnableLocalization>
<PostBuildLocalization>$(EnableLocalization)</PostBuildLocalization>
<!-- This corresponds to the APEX13 languages: Tier1 + CSY/TRK/PLK
For language sets details, see: https://ceapex.visualstudio.com/CEINTL/_git/SoftwareLocalization?path=%2Fsrc%2FOneBranchPackages%2FLocalization.Languages%2FLocalization.Languages.props&_a=contents&version=GBmain
-->
<LanguageSet Condition="'$(EnableLocalization)' == 'true'">VS_Main_Languages</LanguageSet>
</PropertyGroup>

<PropertyGroup>
<NoWarn>1591</NoWarn>
</PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion SqlScriptDom/Parser/TSql/Ast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@
</Class>
<Class Name="ViewHashDistributionPolicy" Base="ViewDistributionPolicy" Summary="Representation of the HASH option for a materialized view distribution policy.">
<InheritedClass Name="ViewDistributionPolicy"/>
<Member Name="DistributionColumn" Type="Identifier" GenerateUpdatePositionInfoCall="false" Summary="The column reference in the HASH option for a view distribution policy."/>
<Member Name="DistributionColumn" Type="Identifier" CollectionFirstItem="true" GenerateUpdatePositionInfoCall="false" Summary="The column reference in the HASH option for a view distribution policy."/>
<Member Name="DistributionColumns" Type="Identifier" Collection="true" GenerateUpdatePositionInfoCall="false" Summary="The columns reference in the HASH option for a view distribution policy."/>
</Class>
<Class Name="TriggerObject" Summary="Information on what trigger is being created/altered" >
<Member Name="Name" Type="SchemaObjectName" Summary="The object to create the trigger on."/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ private ExternalFileFormatOptionHelper()
AddOptionMapping(ExternalFileFormatOptionKind.DataCompression, CodeGenerationSupporter.DataCompression);
AddOptionMapping(ExternalFileFormatOptionKind.FirstRow, CodeGenerationSupporter.FirstRow2);
AddOptionMapping(ExternalFileFormatOptionKind.Encoding, CodeGenerationSupporter.Encoding);
AddOptionMapping(ExternalFileFormatOptionKind.ParserVersion, CodeGenerationSupporter.ParserVersion);
}

internal static readonly ExternalFileFormatOptionHelper Instance = new ExternalFileFormatOptionHelper();
Expand Down
3 changes: 2 additions & 1 deletion SqlScriptDom/Parser/TSql/ExternalFileFormatOptionKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public enum ExternalFileFormatOptionKind
UseTypeDefault = 5,
DataCompression = 6,
FirstRow = 7,
Encoding = 8
Encoding = 8,
ParserVersion = 9
}

#pragma warning restore 1591
Expand Down
1 change: 0 additions & 1 deletion SqlScriptDom/Parser/TSql/TSql100.g
Original file line number Diff line number Diff line change
Expand Up @@ -11984,7 +11984,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
: tOption:Identifier
{
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
UpdateTokenInfo(vResult, tOption);
}
;

Expand Down
1 change: 0 additions & 1 deletion SqlScriptDom/Parser/TSql/TSql110.g
Original file line number Diff line number Diff line change
Expand Up @@ -13994,7 +13994,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
: tOption:Identifier
{
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
UpdateTokenInfo(vResult, tOption);
}
;

Expand Down
1 change: 0 additions & 1 deletion SqlScriptDom/Parser/TSql/TSql120.g
Original file line number Diff line number Diff line change
Expand Up @@ -14396,7 +14396,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
: tOption:Identifier
{
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
UpdateTokenInfo(vResult, tOption);
}
;

Expand Down
13 changes: 10 additions & 3 deletions SqlScriptDom/Parser/TSql/TSql130.g
Original file line number Diff line number Diff line change
Expand Up @@ -15640,7 +15640,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
: tOption:Identifier
{
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
UpdateTokenInfo(vResult, tOption);
}
;

Expand Down Expand Up @@ -23118,12 +23117,20 @@ viewHashDistributionPolicy returns [ViewHashDistributionPolicy vResult = Fragmen
Identifier vIdentifier;
}
:
tHash:Identifier LeftParenthesis vIdentifier = identifier
tHash:Identifier
{
Match(tHash, CodeGenerationSupporter.Hash);
vResult.DistributionColumn = vIdentifier;
UpdateTokenInfo(vResult, tHash);
}
LeftParenthesis vIdentifier = identifier
{
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
}
(Comma vIdentifier = identifier
{
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
}
)*
tRParen:RightParenthesis
{
UpdateTokenInfo(vResult, tRParen);
Expand Down
13 changes: 10 additions & 3 deletions SqlScriptDom/Parser/TSql/TSql140.g
Original file line number Diff line number Diff line change
Expand Up @@ -16025,7 +16025,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
: tOption:Identifier
{
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
UpdateTokenInfo(vResult, tOption);
}
;

Expand Down Expand Up @@ -23687,12 +23686,20 @@ viewHashDistributionPolicy returns [ViewHashDistributionPolicy vResult = Fragmen
Identifier vIdentifier;
}
:
tHash:Identifier LeftParenthesis vIdentifier = identifier
tHash:Identifier
{
Match(tHash, CodeGenerationSupporter.Hash);
vResult.DistributionColumn = vIdentifier;
UpdateTokenInfo(vResult, tHash);
}
LeftParenthesis vIdentifier = identifier
{
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
}
(Comma vIdentifier = identifier
{
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
}
)*
tRParen:RightParenthesis
{
UpdateTokenInfo(vResult, tRParen);
Expand Down
13 changes: 10 additions & 3 deletions SqlScriptDom/Parser/TSql/TSql150.g
Original file line number Diff line number Diff line change
Expand Up @@ -16695,7 +16695,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
: tOption:Identifier
{
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
UpdateTokenInfo(vResult, tOption);
}
;

Expand Down Expand Up @@ -24433,12 +24432,20 @@ viewHashDistributionPolicy returns [ViewHashDistributionPolicy vResult = Fragmen
Identifier vIdentifier;
}
:
tHash:Identifier LeftParenthesis vIdentifier = identifier
tHash:Identifier
{
Match(tHash, CodeGenerationSupporter.Hash);
vResult.DistributionColumn = vIdentifier;
UpdateTokenInfo(vResult, tHash);
}
LeftParenthesis vIdentifier = identifier
{
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
}
(Comma vIdentifier = identifier
{
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
}
)*
tRParen:RightParenthesis
{
UpdateTokenInfo(vResult, tRParen);
Expand Down
16 changes: 12 additions & 4 deletions SqlScriptDom/Parser/TSql/TSql160.g
Original file line number Diff line number Diff line change
Expand Up @@ -16741,7 +16741,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
: tOption:Identifier
{
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
UpdateTokenInfo(vResult, tOption);
}
;

Expand Down Expand Up @@ -24102,7 +24101,8 @@ externalDataFormatLiteralOption returns [ExternalFileFormatLiteralOption vResult
if (vResult.OptionKind != ExternalFileFormatOptionKind.FieldTerminator &&
vResult.OptionKind != ExternalFileFormatOptionKind.StringDelimiter &&
vResult.OptionKind != ExternalFileFormatOptionKind.DateFormat &&
vResult.OptionKind != ExternalFileFormatOptionKind.Encoding)
vResult.OptionKind != ExternalFileFormatOptionKind.Encoding &&
vResult.OptionKind != ExternalFileFormatOptionKind.ParserVersion)
{
throw GetUnexpectedTokenErrorException(tOption);
}
Expand Down Expand Up @@ -24655,12 +24655,20 @@ viewHashDistributionPolicy returns [ViewHashDistributionPolicy vResult = Fragmen
Identifier vIdentifier;
}
:
tHash:Identifier LeftParenthesis vIdentifier = identifier
tHash:Identifier
{
Match(tHash, CodeGenerationSupporter.Hash);
vResult.DistributionColumn = vIdentifier;
UpdateTokenInfo(vResult, tHash);
}
LeftParenthesis vIdentifier = identifier
{
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
}
(Comma vIdentifier = identifier
{
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
}
)*
tRParen:RightParenthesis
{
UpdateTokenInfo(vResult, tRParen);
Expand Down
1 change: 0 additions & 1 deletion SqlScriptDom/Parser/TSql/TSql80.g
Original file line number Diff line number Diff line change
Expand Up @@ -3898,7 +3898,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
: tOption:Identifier
{
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
UpdateTokenInfo(vResult, tOption);
}
;

Expand Down
1 change: 0 additions & 1 deletion SqlScriptDom/Parser/TSql/TSql90.g
Original file line number Diff line number Diff line change
Expand Up @@ -9640,7 +9640,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
: tOption:Identifier
{
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
UpdateTokenInfo(vResult, tOption);
}
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ public override void ExplicitVisit(ViewHashDistributionPolicy node)
{
GenerateIdentifier(CodeGenerationSupporter.Hash);
GenerateSymbol(TSqlTokenType.LeftParenthesis);
GenerateFragmentIfNotNull(node.DistributionColumn);

if (node.DistributionColumns?.Count > 0)
{
GenerateCommaSeparatedList(node.DistributionColumns);
}

GenerateSymbol(TSqlTokenType.RightParenthesis);
}
}
Expand Down
37 changes: 37 additions & 0 deletions Test/SqlDom/Baselines130/MaterializedViewTests130.sql
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,40 @@ AS
BEGIN
ALTER MATERIALIZED VIEW View1 DISABLE;
END


GO
CREATE MATERIALIZED VIEW View1MCD
WITH (DISTRIBUTION = HASH(Col4, Col5), FOR_APPEND)
AS
SELECT MAX(Col1) AS Max_Col1,
MIN(Col2) AS Min_Col2,
Col3,
Col4,
Col5
FROM dbo.Table1
GROUP BY Col3, Col4, Col5;


GO
CREATE MATERIALIZED VIEW View2MCD
WITH (FOR_APPEND, DISTRIBUTION = HASH(Col3, Col5))
AS
SELECT MAX(Col1) AS Max_Col1,
MIN(Col2) AS Min_Col2,
Col3,
Col4,
Col5
FROM dbo.Table1
GROUP BY Col3, Col4, Col5;


GO
CREATE MATERIALIZED VIEW View3MCD
WITH (DISTRIBUTION = HASH(Col3, Col4, Col5))
AS
SELECT Col3,
Col4,
Col5
FROM dbo.Table1
GROUP BY Col3, Col4, Col5;
34 changes: 34 additions & 0 deletions Test/SqlDom/Baselines140/MaterializedViewTests140.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
CREATE MATERIALIZED VIEW View1MCD
WITH (DISTRIBUTION = HASH(Col4, Col5), FOR_APPEND)
AS
SELECT MAX(Col1) AS Max_Col1,
MIN(Col2) AS Min_Col2,
Col3,
Col4,
Col5
FROM dbo.Table1
GROUP BY Col3, Col4, Col5;


GO
CREATE MATERIALIZED VIEW View2MCD
WITH (FOR_APPEND, DISTRIBUTION = HASH(Col3, Col5))
AS
SELECT MAX(Col1) AS Max_Col1,
MIN(Col2) AS Min_Col2,
Col3,
Col4,
Col5
FROM dbo.Table1
GROUP BY Col3, Col4, Col5;


GO
CREATE MATERIALIZED VIEW View3MCD
WITH (DISTRIBUTION = HASH(Col3, Col4, Col5))
AS
SELECT Col3,
Col4,
Col5
FROM dbo.Table1
GROUP BY Col3, Col4, Col5;
34 changes: 34 additions & 0 deletions Test/SqlDom/Baselines150/MaterializedViewTests150.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
CREATE MATERIALIZED VIEW View1MCD
WITH (DISTRIBUTION = HASH(Col4, Col5), FOR_APPEND)
AS
SELECT MAX(Col1) AS Max_Col1,
MIN(Col2) AS Min_Col2,
Col3,
Col4,
Col5
FROM dbo.Table1
GROUP BY Col3, Col4, Col5;


GO
CREATE MATERIALIZED VIEW View2MCD
WITH (FOR_APPEND, DISTRIBUTION = HASH(Col3, Col5))
AS
SELECT MAX(Col1) AS Max_Col1,
MIN(Col2) AS Min_Col2,
Col3,
Col4,
Col5
FROM dbo.Table1
GROUP BY Col3, Col4, Col5;


GO
CREATE MATERIALIZED VIEW View3MCD
WITH (DISTRIBUTION = HASH(Col3, Col4, Col5))
AS
SELECT Col3,
Col4,
Col5
FROM dbo.Table1
GROUP BY Col3, Col4, Col5;
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
CREATE EXTERNAL FILE FORMAT eff1
WITH (
FORMAT_TYPE = DELTA
);

CREATE EXTERNAL FILE FORMAT eff2
WITH (
FORMAT_TYPE = DELIMITEDTEXT,
FORMAT_OPTIONS (PARSER_VERSION = '2.0')
);
Loading