Skip to content

Commit

Permalink
Updated TweetAnalysis TVF example to infer the result type
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRys committed Jun 8, 2016
1 parent 6ee5532 commit f0decea
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
5 changes: 4 additions & 1 deletion Examples/TweetAnalysis/TweetAnalysis/6-CreateMentionTVF.usql
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@

DROP FUNCTION IF EXISTS TweetAndMentionsTVF;

// CREATE FUNCTION can either infer result type or require the result to adhere to the specified result type
CREATE FUNCTION TweetAndMentionsTVF(@path string ="default")
RETURNS @res TABLE(author string, category string, tweetcount long?, file_origin SQL.ARRAY<string>, mentioned_by SQL.ARRAY<string>)
RETURNS @res
//RETURNS @res TABLE(author string, category string, tweetcount long?, file_origin SQL.ARRAY<string>, mentioned_by SQL.ARRAY<string>)
AS
BEGIN

// In order to see the user-code inside the TVF, you have to reference the assembly inside the TVF body.
REFERENCE ASSEMBLY TweetAnalysis;

@t =
Expand Down
31 changes: 23 additions & 8 deletions Examples/TweetAnalysis/TweetAnalysis/TweetAnalysisScripts.usqlproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@
</PropertyGroup>
<ItemGroup>
<Script Include="1-SimpleAnalysis-1File.usql">
<UseLocalComputeAccount>true</UseLocalComputeAccount>
<UseLocalComputeAccount>false</UseLocalComputeAccount>
<LocalComputeAccount>localcomputeaccount</LocalComputeAccount>
<LocalDatabase>master</LocalDatabase>
<LocalSchema>dbo</LocalSchema>
<ClusterComputeAccount>mryskona</ClusterComputeAccount>
<ClusterDatabase>master</ClusterDatabase>
<ClusterSchema>dbo</ClusterSchema>
</Script>
<Script Include="2-ExtractMentions-InlineCode-1File.usql">
<UseLocalComputeAccount>false</UseLocalComputeAccount>
Expand All @@ -40,19 +43,25 @@
<ClusterSchema>dbo</ClusterSchema>
</Script>
<Script Include="3-ExtractMentions-CodeBehind-1File.usql">
<UseLocalComputeAccount>true</UseLocalComputeAccount>
<UseLocalComputeAccount>false</UseLocalComputeAccount>
<LocalComputeAccount>localcomputeaccount</LocalComputeAccount>
<LocalDatabase>master</LocalDatabase>
<LocalSchema>dbo</LocalSchema>
<ClusterComputeAccount>mryskona</ClusterComputeAccount>
<ClusterDatabase>master</ClusterDatabase>
<ClusterSchema>dbo</ClusterSchema>
</Script>
<Script Include="4-ExtractMentions-RefAsm-1File.usql">
<UseLocalComputeAccount>true</UseLocalComputeAccount>
<UseLocalComputeAccount>false</UseLocalComputeAccount>
<LocalComputeAccount>localcomputeaccount</LocalComputeAccount>
<LocalDatabase>master</LocalDatabase>
<LocalSchema>dbo</LocalSchema>
<ClusterComputeAccount>mryskona</ClusterComputeAccount>
<ClusterDatabase>master</ClusterDatabase>
<ClusterSchema>dbo</ClusterSchema>
</Script>
<Script Include="5-ExtractMentions-RefAsm-FileSet.usql">
<UseLocalComputeAccount>true</UseLocalComputeAccount>
<UseLocalComputeAccount>false</UseLocalComputeAccount>
<LocalComputeAccount>localcomputeaccount</LocalComputeAccount>
<LocalDatabase>master</LocalDatabase>
<LocalSchema>dbo</LocalSchema>
Expand All @@ -61,7 +70,7 @@
<ClusterSchema>dbo</ClusterSchema>
</Script>
<Script Include="6-CreateMentionTVF.usql">
<UseLocalComputeAccount>true</UseLocalComputeAccount>
<UseLocalComputeAccount>false</UseLocalComputeAccount>
<LocalComputeAccount>localcomputeaccount</LocalComputeAccount>
<LocalDatabase>master</LocalDatabase>
<LocalSchema>dbo</LocalSchema>
Expand All @@ -70,7 +79,7 @@
<ClusterSchema>dbo</ClusterSchema>
</Script>
<Script Include="7-CreateMentionTables.usql">
<UseLocalComputeAccount>true</UseLocalComputeAccount>
<UseLocalComputeAccount>false</UseLocalComputeAccount>
<LocalComputeAccount>localcomputeaccount</LocalComputeAccount>
<LocalDatabase>master</LocalDatabase>
<LocalSchema>dbo</LocalSchema>
Expand All @@ -79,16 +88,22 @@
<ClusterSchema>dbo</ClusterSchema>
</Script>
<Script Include="8-TweetAnalysis-WindowingExpr.usql">
<UseLocalComputeAccount>true</UseLocalComputeAccount>
<UseLocalComputeAccount>false</UseLocalComputeAccount>
<LocalComputeAccount>localcomputeaccount</LocalComputeAccount>
<LocalDatabase>master</LocalDatabase>
<LocalSchema>dbo</LocalSchema>
<ClusterComputeAccount>mryskona</ClusterComputeAccount>
<ClusterDatabase>master</ClusterDatabase>
<ClusterSchema>dbo</ClusterSchema>
</Script>
<Script Include="9-AddNewTweets.usql">
<UseLocalComputeAccount>true</UseLocalComputeAccount>
<UseLocalComputeAccount>false</UseLocalComputeAccount>
<LocalComputeAccount>localcomputeaccount</LocalComputeAccount>
<LocalDatabase>master</LocalDatabase>
<LocalSchema>dbo</LocalSchema>
<ClusterComputeAccount>mryskona</ClusterComputeAccount>
<ClusterDatabase>master</ClusterDatabase>
<ClusterSchema>dbo</ClusterSchema>
</Script>
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit f0decea

Please sign in to comment.