terrajobst / nquery

NQuery is a relational query engine written in C#. It allows you to execute a SELECT query against .NET objects.
MIT License
72 stars 20 forks source link

Overflow exception #22

Open terrajobst opened 9 years ago

terrajobst commented 9 years ago

Ported from CodePlex

SELECT (e.EmployeeID * (3000000000)).GetType() AS MyType
FROM Employees e

Query crashes with:

System.OverflowException: Value was either too large or too small for an Int32. at System.Convert.ToInt32(Int64 value) at System.Int64.System.IConvertible.ToInt32(IFormatProvider provider) at System.Convert.ToInt32(Object value) at NQuery.Compilation.ConstantExpression.get_AsInt32() in K:\NQuery\Trunk\Src\NQuery\AST\ConstantExpression.cs:line 60 at NQuery.Compilation.TextGenerator.VisitLiteralValue(LiteralExpression expression) in K:\NQuery\Trunk\Src\NQuery\AST\Visitors\TextGenerator.cs:line 56 at NQuery.Compilation.StandardVisitor.Visit(AstNode node) in K:\NQuery\Trunk\Src\NQuery\AST\Visitors\StandardVisitor.cs:line 18 at NQuery.Compilation.IdGenerator.VisitBinaryExpression(BinaryExpression expression) in K:\NQuery\Trunk\Src\NQuery\AST\Visitors\IdGenerator.cs:line 42 at NQuery.Compilation.StandardVisitor.Visit(AstNode node) in K:\NQuery\Trunk\Src\NQuery\AST\Visitors\StandardVisitor.cs:line 23 at NQuery.Compilation.IdGenerator.VisitMethodInvocationExpression(MethodInvocationExpression expression) in K:\NQuery\Trunk\Src\NQuery\AST\Visitors\IdGenerator.cs:line 195 at NQuery.Compilation.StandardVisitor.Visit(AstNode node) in K:\NQuery\Trunk\Src\NQuery\AST\Visitors\StandardVisitor.cs:line 50 at NQuery.Compilation.AstNode.GenerateId() in K:\NQuery\Trunk\Src\NQuery\AST\AstNode.cs:line 10 at NQuery.Compilation.RowBufferBuilder.VisitComputeScalar(ComputeScalarNode node) in K:\NQuery\Trunk\Src\NQuery\Compilation\RowBufferBuilder.cs:line 26 at NQuery.Runtime.ExecutionPlan.ExecutionPlanVisitor.Visit(ExecutionPlanNode node) in K:\NQuery\Trunk\Src\NQuery\Execution Plan\ExecutionPlanVisitor.cs:line 30 at NQuery.Runtime.ExecutionPlan.ExecutionPlanVisitor.VisitResult(ResultNode node) in K:\NQuery\Trunk\Src\NQuery\Execution Plan\ExecutionPlanVisitor.cs:line 60 at NQuery.Runtime.ExecutionPlan.ExecutionPlanVisitor.Visit(ExecutionPlanNode node) in K:\NQuery\Trunk\Src\NQuery\Execution Plan\ExecutionPlanVisitor.cs:line 14 at NQuery.Compilation.Compiler.DeprecatedCompileQuery(String queryText, Scope scope) in K:\NQuery\Trunk\Src\NQuery\Compilation\Compiler.cs:line 196 at NQuery.Compilation.Compiler.CompileQuery(String queryText, Scope scope, AlgebraNode& algebrizedQuery) in K:\NQuery\Trunk\Src\NQuery\Compilation\Compiler.cs:line 157 at NQuery.Query.Compile() in K:\NQuery\Trunk\Src\NQuery\Query.cs:line 98 at NQuery.Query.EnsureCompiled() in K:\NQuery\Trunk\Src\NQuery\Query.cs:line 84 at NQuery.Query.GetExecutionPlan() in K:\NQuery\Trunk\Src\NQuery\Query.cs:line 118 at NQuery.Gui.MainForm.ExplainQuery() in K:\NQuery\Trunk\Src\NQuery.Gui\MainForm.cs:line 156 at NQuery.Gui.MainForm.explainToolStripMenuItem_Click(Object sender, EventArgs e) in K:\NQuery\Trunk\Src\NQuery.Gui\MainForm.cs:line 661 at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e) at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStripMenuItem.ProcessCmdKey(Message& m, Keys keyData) at System.Windows.Forms.ToolStripManager.ProcessShortcut(Message& m, Keys shortcut) at System.Windows.Forms.ToolStripManager.ProcessCmdKey(Message& m, Keys keyData) at System.Windows.Forms.ContainerControl.ProcessCmdKey(Message& msg, Keys keyData) at System.Windows.Forms.Form.ProcessCmdKey(Message& msg, Keys keyData) at NQuery.Gui.MainForm.ProcessCmdKey(Message& msg, Keys keyData) in K:\NQuery\Trunk\Src\NQuery.Gui\MainForm.cs:line 633 at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData) at System.Windows.Forms.Control.PreProcessMessage(Message& msg) at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg) at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)

dallmair commented 7 years ago

Works fine in v.Next.