Answered Type mismatch in Query

  • Thursday, October 08, 2009 12:23 AM
     
     

    Another question is: What is wrong with the following query? The compile time error that comes up is:

    1.       Instance argument: cannot convert from 'Microsoft.ComplexEventProcessing.Linq.CepStream<double>' to 'Microsoft.ComplexEventProcessing.Linq.CepStream<MarloweStreamInsight.MarloweImplicitServer.InputType>'

    2.       'Microsoft.ComplexEventProcessing.Linq.CepStream<double>' does not contain a definition for 'ToQuery' and the best extension method overload 'Microsoft.ComplexEventProcessing.Linq.CepStream.ToQuery<T>(Microsoft.ComplexEventProcessing.Linq.CepStream<T>, Microsoft.ComplexEventProcessing.Linq.CepStreamConsumer<T>)' has some invalid arguments

     

    I know that windows.SValue is of type double and ToQuery takes generic InputType. What can be done to circumvent this?

     

     

     

                    var top =  from windows in inputDataStream

                                where windows.Type == "CPU" && windows.SValue > 10

                                select windows.SValue;

     

                   

                   

     

                    // Create query from the LINQ statement and feed it into the

                    // consumer

                    //Query query = top.ToQuery<InputType>(streamConsumer);

                    Query query = top.ToQuery<InputType>(streamConsumer);

                    consoleTracer.WriteLine("Start query");

     Sorry if my question sounds basic, I am working towards a deadline and I am new to StreamInsight.

All Replies

  • Friday, October 09, 2009 5:57 AM
    Moderator
     
     Answered
    Sid,
    You can't select the field "SValue" directly. You can just output the events that passed the filer themselves ("... select windows") or create a type with a single field ("... select new { windows.SValue }"). However, this depends on the type that the output adapter expects. How do you construct the streamConsumer?
    Regards,
    Roman
    MS StreamInsight Team

    Disclaimer: This posting is provided "AS IS" with no warranties, and confers no rights.