Created
November 11, 2015 19:25
-
-
Save mwinkle/86a939beedc0863bc50a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' sample U-SQL UDO (Processor) written in VB.NET | |
Imports Microsoft.Analytics.Interfaces | |
Public Class vbProcessor | |
Inherits IProcessor | |
Private CountryTranslation As New Dictionary(Of String, String) From | |
{{"Deutschland", "Germany"}, | |
{"Schwiiz", "Switzerland"}, | |
{"UK", "United Kingdom"}, | |
{"USA", "United States of America"}, | |
{"中国", "PR China"}} | |
Public Overrides Function Process(input As IRow, output As IUpdatableRow) As IRow | |
Dim UserId = input.Get(Of String)("UserId") | |
Dim Name = input.Get(Of String)("Name") | |
Dim Address = input.Get(Of String)("Address") | |
Dim City = input.Get(Of String)("City") | |
Dim State = input.Get(Of String)("State") | |
Dim PostalCode = input.Get(Of String)("PostalCode") | |
Dim Country = input.Get(Of String)("Country") | |
If (CountryTranslation.ContainsKey(Country)) Then | |
Country = CountryTranslation(Country) | |
End If | |
Dim Phone = input.Get(Of String)("Phone") | |
output.Set(0, UserId) | |
output.Set(1, Name) | |
output.Set(2, Address) | |
output.Set(3, City) | |
output.Set(4, State) | |
output.Set(5, PostalCode) | |
output.Set(6, Country) | |
output.Set(7, Phone) | |
Return output.AsReadOnly() | |
End Function | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment