Hi Stephen,

Thanks a lot for your prompt response. Your response is helpful.

To implement my usecase, it seems I need to leverage MULTISET which stores 
objects and its count in Map. In my case key can be the object and value can be 
the count.

Thanks,
Anil.

From: Stefan Kupstaitis-Dunkler [mailto:[email protected]]
Sent: Friday, January 4, 2019 5:21 PM
To: [email protected]
Cc: Christopher Berry <[email protected]>; Satish Abburi 
<[email protected]>
Subject: Re: MAP Data structure in Stellar to store key/value pairs

Hi Anil,

the easiest way to define a map in the Stellar language is to define it via a 
variable assignment in a JSON format.


  *   For example, below I define a map called kafka_props.
  *   Then, with "MAP_EXISTS" I check if the map ( => JSON object) has a key 
"security.protocol", which it has
  *   Then I try to extract the value of the key "security.protocol" and get 
the correct value of "SASL_PLAINTEXT".

[Stellar]>>> kafka_props := { "bootstrap.servers": 
"condla1.field.hortonworks.com:6667<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fcondla1.field.hortonworks.com%3a6667&c=E,1,kV8zHoG2q0Nc914Rsy-CqiQUASnC2KJzdhnmzuiqedICznMjc594ym7qCUgieeJK9hxScFT7nW1mlpW8bnZcL47sAxM1I0c5ovHgYYq4TjRgiQ,,&typo=1>",
 "security.protocol": "SASL_PLAINTEXT"}
{security.protocol=SASL_PLAINTEXT, 
bootstrap.servers=condla1.field.hortonworks.com:6667<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fcondla1.field.hortonworks.com%3a6667&c=E,1,Hpt8rMt0s0AMdwKgpTaqWnGhED2yjszVCRAtBe9bJCmgX0C-gf7ogrPYAnwx5BnvmKhT84D3KdAVBpEziOENBptlQEOmXBw-wh54U-MpLGgK_HfaDR8,&typo=1>}

[Stellar]>>> MAP_EXISTS("security.protocol", kafka_props)
true

[Stellar]>>> MAP_GET("security.protocol", kafka_props)
SASL_PLAINTEXT

As of now, I don't think there is a MAP_PUT .  In most of the Metron use cases, 
the map is either the incoming message or an external enrichment and you use 
MAP_GET to extract information from it.

Does this answer your question?

Best,
Stefan


On Fri, Jan 4, 2019 at 12:26 PM Anil Donthireddy 
<[email protected]<mailto:[email protected]>> wrote:
Hi,

I have gone through the stellar documentation to understand how to store 
key/value pairs in to an stellar object. I can see there are functions 
MAP_EXISTS() and MAP_GET() that do operations on key/value pairs.

But I am unable to find how to initialize MAP object and add/update key/value 
pairs in the MAP. Please help to store key/value pairs in stellar object.

Thanks,
Anil.

Reply via email to