Created
May 14, 2011 20:33
-
-
Save cscotta/972601 to your computer and use it in GitHub Desktop.
Map Operation
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
// Sample Event Stream: | |
{ "event_type": "identification", "name": "nachos" } | |
{ "event_type": "event", "data": {"meat_type": "carnitas", "cheese_temp": 103, "vegetables": ["tomatoes", "olives"] } } | |
{ "event_type": "event", "data": {"meat_type": "beef", "cheese_temp": 101, "vegetables": ["tomatoes", "olives"] } } | |
{ "event_type": "event", "data": {"meat_type": "chicken", "cheese_temp": 98, "vegetables": ["tomatoes", "olives"] } } | |
// Sample Query: | |
{ | |
"stream_id" : "nachos", | |
"stages": | |
[ | |
{ | |
"query_type": "map", | |
"key": "cheese_temp", | |
"result_key": "cheese_temp_celsius", | |
"operation": "(value - 32) * (5/9)" | |
} | |
] | |
} | |
// Sample results: | |
{ "meat_type": "carnitas", "cheese_temp": 103, "vegetables": ["tomatoes", "olives"], "cheese_temp_celsius":39.44444444444444 } | |
{ "meat_type": "beef", "cheese_temp": 101, "vegetables": ["tomatoes", "olives"], "cheese_temp_celsius":38.333333333333336 } | |
{ "meat_type": "chicken", "cheese_temp": 98, "vegetables": ["tomatoes", "olives"], "cheese_temp_celsius":36.66666666666667 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment