On the topic of a 'map add', in many cases you should not dynamically add elements to a map because it would be difficult to control the size of that map. It could grow very large. Of course, you can do a size check, but that is rather verbose and not very elegant.
There are probably better ways to implement a use case than map add that results in more concise code. For instance, using the HLLP functions for a distinct count would be one example. On Fri, Jan 4, 2019, 6:50 AM Stefan Kupstaitis-Dunkler <[email protected] wrote: > 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", "security.protocol": > "SASL_PLAINTEXT"} > {security.protocol=SASL_PLAINTEXT, bootstrap.servers= > condla1.field.hortonworks.com:6667} > > [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]> 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. >> >
