br1ghtyang / asterixdb

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

AlgebricksException: Could not infer type for variable '$$0'. #443

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Start asterix using managix, one NC and CC. Run the following statements from 
Web UI.

for $a in [ {"f" : 19} , {"f" : 12} , {"f" : 10} , {"f" : 17}, {"f" : 12} ]
distinct by $a.f
order by $a.f
return $a

Logical Plan :

distribute result [%0->$$0] -- |UNPARTITIONED|
  project ([$$0]) -- |UNPARTITIONED|
    order (ASC, function-call: asterix:field-access-by-name, Args:[%0->$$0, AString: {f}])  -- |UNPARTITIONED|
      distinct ([function-call: asterix:field-access-by-name, Args:[%0->$$0, AString: {f}]]) -- |UNPARTITIONED|
        unnest $$0 <- function-call: asterix:scan-collection, Args:[function-call: asterix:ordered-list-constructor, Args:[function-call: asterix:open-record-constructor, Args:[AString: {f}, AInt32: {19}], function-call: asterix:open-record-constructor, Args:[AString: {f}, AInt32: {12}], function-call: asterix:open-record-constructor, Args:[AString: {f}, AInt32: {10}], function-call: asterix:open-record-constructor, Args:[AString: {f}, AInt32: {17}], function-call: asterix:open-record-constructor, Args:[AString: {f}, AInt32: {12}]]] -- |UNPARTITIONED|
          empty-tuple-source -- |UNPARTITIONED|

edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: Could not 
infer type for variable '$$0'.

Stack trace from CC.log

SEVERE: edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: Could not 
infer type for variable '$$0'.
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: Could not 
infer type for variable '$$0'.
        at edu.uci.ics.asterix.aql.translator.AqlTranslator.compileAndExecute(AqlTranslator.java:292)
        at edu.uci.ics.asterix.api.http.servlet.APIServlet.doPost(APIServlet.java:78)
        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)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:43)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:545)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:43)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
        at java.lang.Thread.run(Thread.java:722)
Caused by: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: Could not 
infer type for variable '$$0'.
        at edu.uci.ics.asterix.aql.translator.AqlTranslator.handleQuery(AqlTranslator.java:1464)
        at edu.uci.ics.asterix.aql.translator.AqlTranslator.compileAndExecute(AqlTranslator.java:277)
        ... 22 more
Caused by: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: Could not 
infer type for variable '$$0'.
        at edu.uci.ics.asterix.optimizer.rules.SetClosedRecordConstructorsRule$SettingClosedRecordVisitor.visitVariableReferenceExpression(SetClosedRecordConstructorsRule.java:155)
        at edu.uci.ics.asterix.optimizer.rules.SetClosedRecordConstructorsRule$SettingClosedRecordVisitor.visitVariableReferenceExpression(SetClosedRecordConstructorsRule.java:62)
        at edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression.accept(VariableReferenceExpression.java:98)
        at edu.uci.ics.asterix.optimizer.rules.SetClosedRecordConstructorsRule$SettingClosedRecordVisitor.transform(SetClosedRecordConstructorsRule.java:76)
        at edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.DistributeResultOperator.acceptExpressionTransform(DistributeResultOperator.java:64)
        at edu.uci.ics.asterix.optimizer.rules.SetClosedRecordConstructorsRule.rewritePost(SetClosedRecordConstructorsRule.java:55)
        at edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:122)
        at edu.uci.ics.hyracks.algebricks.compiler.rewriter.rulecontrollers.SequentialOnceRuleController.rewriteWithRuleCollection(SequentialOnceRuleController.java:40)
        at edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.runOptimizationSets(HeuristicOptimizer.java:79)
        at edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.runPhysicalOptimizations(HeuristicOptimizer.java:110)
        at edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.optimize(HeuristicOptimizer.java:68)
        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:282)
        at edu.uci.ics.asterix.aql.translator.AqlTranslator.rewriteCompileQuery(AqlTranslator.java:1323)
        at edu.uci.ics.asterix.aql.translator.AqlTranslator.handleQuery(AqlTranslator.java:1417)
        ... 23 more

Original issue reported on code.google.com by khfaraaz82 on 14 May 2013 at 2:17

GoogleCodeExporter commented 8 years ago
Adding some more information here.

case 1) this works and gives expected results

for $a in [ {"f" : 19} , {"f" : 12} , {"f" : 10} , {"f" : 17}, {"f" : 12} ]
order by $a.f
return $a

results returned :

{ "f": 10 }
{ "f": 12 }
{ "f": 12 }
{ "f": 17 }
{ "f": 19 }

case 2) this oe fails with Exception

for $a in [ {"f" : 19} , {"f" : 12} , {"f" : 10} , {"f" : 17}, {"f" : 12} ]
distinct by $a.f
return $a

edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: Could not 
infer type for variable '$$0'.

Original comment by khfaraaz82 on 14 May 2013 at 2:33

GoogleCodeExporter commented 8 years ago

Original comment by buyingyi@gmail.com on 23 May 2013 at 7:37

GoogleCodeExporter commented 8 years ago

Original comment by buyingyi@gmail.com on 24 May 2013 at 9:50