br1ghtyang / asterixdb

Automatically exported from code.google.com/p/asterixdb
0 stars 0 forks source link

'AlgebricksException' occurred when using arithmetic operation in index #532

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. run following query

let $a := ["a","b","c","d"]
return {"a": $a[1+1]}

What is the expected output? What do you see instead?
expected output:
{ "a": "c" }

what I got:
get-item: item index cannot be negative! [AlgebricksException]

OS: Mac OS X
Asterix version: 0.8.1-SNAPSHOT

Original issue reported on code.google.com by jimah...@gmail.com on 13 Jun 2013 at 6:57

GoogleCodeExporter commented 8 years ago
Note that this gives example correct results

let $a := ["a","b","c","d"]
return {"a": $a[2]}

returns :

{ "a": "c" }

Here is the stack trace for the failing scenario from cc.log

SEVERE: get-item: item index cannot be negative!
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: get-item: 
item index cannot be negative!
        at edu.uci.ics.asterix.runtime.evaluators.functions.GetItemDescriptor$GetItemEvalFactory$1.evaluate(GetItemDescriptor.java:125)
        at edu.uci.ics.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenToExpressionRuntimeProviderAdapter$ScalarEvaluatorFactoryAdapter$1.evaluate(LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.java:106)
        at edu.uci.ics.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:206)
        at edu.uci.ics.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:135)
        at edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression.accept(ScalarFunctionCallExpression.java:51)
        at edu.uci.ics.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.changeRec(ConstantFoldingRule.java:245)
        at edu.uci.ics.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:167)
        at edu.uci.ics.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:135)
        at edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression.accept(ScalarFunctionCallExpression.java:51)
        at edu.uci.ics.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.transform(ConstantFoldingRule.java:145)
        at edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractAssignOperator.acceptExpressionTransform(AbstractAssignOperator.java:63)
        at edu.uci.ics.asterix.optimizer.rules.ConstantFoldingRule.rewritePost(ConstantFoldingRule.java:132)
        at edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:122)
        at edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:96)
        at edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:96)
        at edu.uci.ics.hyracks.algebricks.compiler.rewriter.rulecontrollers.SequentialFixpointRuleController.rewriteWithRuleCollection(SequentialFixpointRuleController.java:49)
        at edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.runOptimizationSets(HeuristicOptimizer.java:93)
        at edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.optimize(HeuristicOptimizer.java:80)
        at edu.uci.ics.hyracks.algebricks.compiler.api.HeuristicCompilerFactoryBuilder$1$1.optimize(HeuristicCompilerFactoryBuilder.java:81)
        at edu.uci.ics.asterix.api.common.APIFramework.compileQuery(APIFramework.java:286)
        at edu.uci.ics.asterix.aql.translator.AqlTranslator.rewriteCompileQuery(AqlTranslator.java:1293)
        at edu.uci.ics.asterix.aql.translator.AqlTranslator.handleQuery(AqlTranslator.java:1387)
        at edu.uci.ics.asterix.aql.translator.AqlTranslator.compileAndExecute(AqlTranslator.java:279)
        at edu.uci.ics.asterix.api.http.servlet.APIServlet.doPost(APIServlet.java:96)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:546)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:483)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:970)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:411)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:904)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
        at org.eclipse.jetty.server.Server.handle(Server.java:347)
        at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:439)
        at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:924)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:781)

Original comment by khfaraaz82 on 13 Jun 2013 at 7:22

GoogleCodeExporter commented 8 years ago

Original comment by buyingyi@gmail.com on 9 Oct 2014 at 6:55