SQL Server Developer Center > SQL Server Forums > Microsoft StreamInsight > Bug: Cannot use floats as constants in queries

Answered Bug: Cannot use floats as constants in queries

  • Wednesday, February 10, 2010 6:11 AM
     
     

    Hi,

    I've encountered a bug that I would like to report.

    When I have a floating point constant in a query, it generates an exception. The same query works with an integer constant.

    I guess this bug is because of the XML-serialization/deserialization of the query. I'm running StreamInsight on a computer with Swedish language settings. This language setting uses comma (,) as decimal separator instead of dot(.). It seems that StreamInsight serializes it using comma and tries to deserialize using dot.

    This bug is regardless of which development model I use (implicit/explicit/observable).

    Examples

    Working query
                var bigLooserCepStream = (from e1 in cepStream
    
                                          from e2 in cepStream.ShiftEventTime(e => e.StartTime.AddDays(7))
    
                                          where e1.FieldID == "Close" && e2.FieldID == "Close"
    
                                          select new StockQuote()
    
                                          {
    
                                              StockID = "ERIC > 10% drop",
    
                                              FieldID = "Close",
    
                                              Value = (e1.Value - e2.Value) / e2.Value * 100
    
                                          }).Where(e => e.Value < -10);
    
    
    
    

    Non-working query

                var bigLooserCepStream = (from e1 in cepStream
    
                                          from e2 in cepStream.ShiftEventTime(e => e.StartTime.AddDays(7))
    
                                          where e1.FieldID == "Close" && e2.FieldID == "Close"
    
                                          select new StockQuote()
    
                                          {
    
                                              StockID = "ERIC > 10% drop",
    
                                              FieldID = "Close",
    
                                              Value = (e1.Value - e2.Value) / e2.Value * 100
    
                                          }).Where(e => e.Value < -0.10);
    
    
    
    


    Exception Details
    Microsoft.ComplexEventProcessing.InvalidDefinitionException was unhandled
      Message="Input string was not in a correct format."
      Source="Microsoft.ComplexEventProcessing.Diagnostics"
      StackTrace:
           at Microsoft.ComplexEventProcessing.Diagnostics.Exceptions.Throw(Exception exception)
           at Microsoft.ComplexEventProcessing.EmbeddedServerProxy.Create(XmlReader definition, Uri parentName)
           at Microsoft.ComplexEventProcessing.Server.CreateCepObject(CepObject obj)
           at Microsoft.ComplexEventProcessing.Application.CreateQueryTemplate(XmlReader queryTextReader)
           at Microsoft.ComplexEventProcessing.Application.CreateQueryTemplate[T](String queryTemplateName, CepStream`1 streamDefinition)
           at Microsoft.ComplexEventProcessing.AnonymousServerHost.CreateQuery[T](CepStream`1 stream, CepStreamConsumer`1 consumer)
           at Microsoft.ComplexEventProcessing.Linq.CepStream`1.ToQuery(Type adapterType, Object adapterConfig, EventShape eventShape, StreamEventOrder eventOrder)
           at AdvantIQ.StockInsight.Program.runQuery(CepStream`1 cepStream) in C:\Johan\StreamInsightExample\StockInsightImplicit\Program.cs:line 105
           at AdvantIQ.StockInsight.Program.bigLooserExample(CepStream`1 cepStream) in C:\Johan\StreamInsightExample\StockInsightImplicit\Program.cs:line 219
           at AdvantIQ.StockInsight.Program.Main() in C:\Johan\StreamInsightExample\StockInsightImplicit\Program.cs:line 86
           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: System.FormatException
           Message="Input string was not in a correct format."
           Source="mscorlib"
           StackTrace:
                at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
                at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
                at System.Double.Parse(String s, NumberStyles style, NumberFormatInfo info)
                at System.Xml.XmlConvert.ToDouble(String s)
                at Microsoft.ComplexEventProcessing.Expressions.RuntimeTypeDouble.FromXmlString(String value)
                at Microsoft.ComplexEventProcessing.Expressions.RuntimeEventType`1.ObjectFromXmlString(String value)
                at Microsoft.ComplexEventProcessing.Expressions.ConstantExpressionNode.OnParse(XmlReader reader)
                at Microsoft.ComplexEventProcessing.Expressions.ExpressionNode.Parse(XmlReader reader)
                at Microsoft.ComplexEventProcessing.Expressions.ExpressionNode.Parse(XmlReader reader)
                at Microsoft.ComplexEventProcessing.Compiler.CompileNodeOperator.ParseExpression(XmlReader xmlReader, CompileContext context)
                at Microsoft.ComplexEventProcessing.Compiler.CompileNodeSelect.OnParse(XmlReader xmlReader, CompileContext context)
                at Microsoft.ComplexEventProcessing.Compiler.CompileNode.Parse(XmlReader xmlReader, CompileContext context)
                at Microsoft.ComplexEventProcessing.Compiler.CompileNodeQueryTemplate.OnParse(XmlReader xmlReader, CompileContext context)
                at Microsoft.ComplexEventProcessing.Compiler.CompileNode.Parse(XmlReader xmlReader, CompileContext context)
                at Microsoft.ComplexEventProcessing.Compiler.Compiler.ParseCreate(XmlReader xmlReader)
                at Microsoft.ComplexEventProcessing.Compiler.Compiler.ParseCreateAny(XmlReader reader)
                at Microsoft.ComplexEventProcessing.CommandDispatcher.CommandDispatcher.Create(XmlReader definition, Uri parent)
                at Microsoft.ComplexEventProcessing.EmbeddedServerProxy.Create(XmlReader definition, Uri parentName)
           InnerException:


    /Johan Åhlén
    http://blogical.se/blogs/jahlen

Answers

  • Wednesday, February 10, 2010 11:03 PM
     
     Answered
    Thank you Johan for reporting this issue. It has been confirmed to be a bug that we will fix.

    Ping
    Enjoy your life every day!
    • Proposed As Answer by Ping Wang Wednesday, February 10, 2010 11:03 PM
    • Marked As Answer by JAhlenMVP Thursday, February 11, 2010 6:46 AM
    •  

All Replies