locked
Return more than one tuple RRS feed

  • Question

  • I have a query like this in StreamInsight:

                    var actionQuery = from e in query
                                      where e.severity >= 1
                                      select new Message { severity = e.severity ...}

    How can i return more than one tuple? For example, selecting two generated Messages in the above sample? I think it is somehow related to select many but i could not make it work!

    Sunday, November 23, 2014 1:26 PM

Answers

  • Which just highlights my point ;-)

    Understanding how time and timestamps work in StreamInsight is certainly the most difficult part of developing apps. It's a paradigm shift from the way we typically handle data but once you "get" it, it's extremely powerful and will give you more flexibility and better performance than using UDSOs to "get around" timestamp "issues".


    DevBiker (aka J Sawyer)
    Microsoft MVP - Sql Server (StreamInsight)


    Ruminations of J.net


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

    Tuesday, November 25, 2014 12:51 PM
    Moderator

All replies

  • Hi,

    Why not just return e and then you can create the new entity? something like

     var actionQuery = from e in query
                                      where e.severity >= 1
                                      select e

    * Your original query should work ok and bring all element that fit the filter and not only one if there are more.
    Can you post the class code?


    signature   Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]


    • Edited by pituachMVP Sunday, November 23, 2014 3:46 PM
    Sunday, November 23, 2014 3:42 PM
  • A user-defined operator (UDO ... for windows) or a user defined stream operator (UDSO) will let you return multiple items from a single input event. So you'd need to create one of them. From the looks of your query, a UDSO would be appropriate.

    DevBiker (aka J Sawyer)
    Microsoft MVP - Sql Server (StreamInsight)


    Ruminations of J.net


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

    Sunday, November 23, 2014 8:15 PM
    Moderator
  • Hi,

    Yes i am using UDSO now but just considering if there exists a better and more gentle solution. As a matter of fact, i am designing my all queries using UDSO (which is practically easier than normal StreamInsight LINQ queries) and i doubt if StreamInsight brings me a real added value!!!




    • Edited by A.Cormen Monday, November 24, 2014 5:51 AM
    Monday, November 24, 2014 5:46 AM
  • A UDSO is actually pretty efficient. However, I would question why you are designing all of your queries using a UDSO. If you are using them because of their statefulness, then it's very likely that you could accomplish what you need with the right temporal operators ... which would typically be more efficient.

    DevBiker (aka J Sawyer)
    Microsoft MVP - Sql Server (StreamInsight)


    Ruminations of J.net


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

    Monday, November 24, 2014 11:55 AM
    Moderator
  • Hi,

    because timestamp issues are really annoying esp. when you use some operators like union and anti join ... but UDSO, on the other side, is very flexible and cool esp. for stateful and pattern based queries.

    Tuesday, November 25, 2014 11:44 AM
  • Which just highlights my point ;-)

    Understanding how time and timestamps work in StreamInsight is certainly the most difficult part of developing apps. It's a paradigm shift from the way we typically handle data but once you "get" it, it's extremely powerful and will give you more flexibility and better performance than using UDSOs to "get around" timestamp "issues".


    DevBiker (aka J Sawyer)
    Microsoft MVP - Sql Server (StreamInsight)


    Ruminations of J.net


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

    Tuesday, November 25, 2014 12:51 PM
    Moderator