Created
November 27, 2013 23:08
-
-
Save shawnhermans/7684660 to your computer and use it in GitHub Desktop.
Simple example of converting tuples to a map
This file contains 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
@outputSchema("output:map[]") | |
def tupleToMap(inputs): | |
field_names = ["field1", "field2", "field3"] | |
result = {} | |
if len(field_names) == len(inputs): | |
for i in range(len(inputs)): | |
result[field_names[i]] = inputs[i] | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment