Hi Anil, Stefan is quite correct about initializing map objects in stellar. I would point out that, given you're using a multiset, you could also initialize your data structure with MULTISET_INIT() and interact with it via MULTISET_ADD(), similar to the geographic outliers use-case (we do this in the profile creation section: https://github.com/apache/metron/tree/master/use-cases/geographic_login_outliers#create-the-profiles-for-enrichment ).
Casey On Fri, Jan 4, 2019 at 7:10 AM Anil Donthireddy <anil.donthire...@sstech.us> wrote: > 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:stefan....@gmail.com] > *Sent:* Friday, January 4, 2019 5:21 PM > *To:* user@metron.apache.org > *Cc:* Christopher Berry <christopher.be...@sstech.us>; Satish Abburi < > satish.abb...@sstech.us> > *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 < > anil.donthire...@sstech.us> 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. > >