Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Performs a mapping of incoming attributes to out-coming attributes using map functions. Odysseus also provides a wide range of mapping functions.

Hint: Map is stateless. To used Map in a statebased fashion see: StateMap

...

  • expressions: A list of expressions to map multiple incoming attribute values to out-coming attributes. Optional each expression can have a name (in this case use ['expression', 'expressionName'])
  • threads: Number of threads used to process the expressions simultaneous. A positive number greater than 1 indicates the fixed number of threads, a value of 0 or 1 disables threading, and a negative number estimates the number of threads based on the number of expressions and the available processors.
  • allownull: If set to true (default) and an error occurs in calculation a null value is added to the element. Else the element is skipped and no output is produced. Default is true.

  • kvexpressions: Same as expressions, but for key value objects. (only for use with key value objects)evaluateOnPunctuation: If set to true, map will also create an output (with the last read element) when it receives a punctuation.
  • supressErrors: If set to true calculation errors will not appear in log or console. Could be helpful in scenarios where null values are allowed.
  • keepAttributes: If set to true, all key value pairs will be kept, even if not mentioned in kvexpressions. (only for use with key value objects)the input object will be copied to the output object. Remark: Not usable in keyvalue, here you should use $ instead
  • removeAttribtues:A List of attributes, which will be removed from the key value input object. (only for use with key value objects)Only valid together with keepAttributes.

Example

PQL
Code Block
languagejavascript
themeEclipse
titleMap Operator
linenumberstrue
output = MAP({
              expressions = [
								['auction_id * 5','AuctionMult5'],
								'sqrt(auction_id)'
							]
             }, input)

///Example for use with key value objects
kvoutput = MAP({
				kvExpressions = [
									['toLong(timestamp.unixtimestamp + 1)', 'Zeit']
                            	],
                keepAllAttributes = 'true',
                removeAttributes = ['uncorrectedTrack.mbid', 'track.artist.mbid', 'track.mbid', 'uncorrectedTrack.artist.mbid']
			}, json)
CQL
Code Block
languagesql
themeEclipse
titleMap Operator
linenumberstrue
SELECT auction_id * 5, sqrt(auction_id) FROM input