asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yingyi Bu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ASTERIXDB-1574) Result of subquery in where clause could not be cast to a scalar value
Date Tue, 16 Aug 2016 17:13:20 GMT

    [ https://issues.apache.org/jira/browse/ASTERIXDB-1574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15423078#comment-15423078
] 

Yingyi Bu commented on ASTERIXDB-1574:
--------------------------------------

It turns out that the behavior is expected. In the subquery, "samptable" refers to the (implicit)
binding variable "sample" defined in the outer query, which binds a record instead of a collection,
and hence you cannot use "from" to unnest it.
I'll make the error message more user friendly.

> Result of subquery in where clause could not be cast to a scalar value
> ----------------------------------------------------------------------
>
>                 Key: ASTERIXDB-1574
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1574
>             Project: Apache AsterixDB
>          Issue Type: Bug
>         Environment: Master branch with latest commit id: bd3a535b171a5cc7486175
>            Reporter: Vignesh Raghunathan
>            Assignee: Yingyi Bu
>
> To reproduce the issue, run the following sqlpp statements:
> {code}
> drop dataverse sampdb if exists;
> create dataverse sampdb;
> use sampdb;
> drop dataset samptable if exists;
> drop type samptabletype if exists;
> create type samptabletype as closed {
>   id: int64
> };
> create dataset samptable(samptabletype) primary key id;
> insert into samptable ({'id' : 1});
> insert into samptable ({'id' : 2});
> insert into samptable ({'id' : 3});
> insert into samptable ({'id' : 4});
> insert into samptable ({'id' : 5});
> select *
> from samptable 
> where id > (select value avg(id) from samptable)[0];
> {code}
> Result:
> {code}
> org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: The input type for
input argument 0(ARecord) is not expected.
> 	at org.apache.asterix.om.typecomputer.impl.CollectionMemberResultType.checkArgType(CollectionMemberResultType.java:40)
> 	at org.apache.asterix.om.typecomputer.base.AbstractResultTypeComputer.lambda$computeType$2(AbstractResultTypeComputer.java:39)
> 	at org.apache.asterix.om.typecomputer.base.AbstractResultTypeComputer$$Lambda$18/1226615280.checkArgTypes(Unknown
Source)
> 	at org.apache.asterix.om.typecomputer.impl.TypeComputeUtils.resolveResultType(TypeComputeUtils.java:92)
> 	at org.apache.asterix.om.typecomputer.base.AbstractResultTypeComputer.computeType(AbstractResultTypeComputer.java:39)
> 	at org.apache.asterix.dataflow.data.common.AqlExpressionTypeComputer.getTypeForFunction(AqlExpressionTypeComputer.java:80)
> 	at org.apache.asterix.dataflow.data.common.AqlExpressionTypeComputer.getType(AqlExpressionTypeComputer.java:53)
> 	at org.apache.hyracks.algebricks.core.algebra.typing.AbstractTypeEnvironment.getType(AbstractTypeEnvironment.java:45)
> 	at org.apache.hyracks.algebricks.core.algebra.operators.logical.UnnestOperator.computeOutputTypeEnvironment(UnnestOperator.java:51)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AlgebricksOptimizationContext.computeAndSetTypeEnvironmentForOperator(AlgebricksOptimizationContext.java:298)
> 	at org.apache.hyracks.algebricks.rewriter.rules.InferTypesRule.rewritePost(InferTypesRule.java:42)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:126)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:112)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.compiler.rewriter.rulecontrollers.SequentialOnceRuleController.rewriteWithRuleCollection(SequentialOnceRuleController.java:44)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.runOptimizationSets(HeuristicOptimizer.java:102)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.optimize(HeuristicOptimizer.java:82)
> 	at org.apache.hyracks.algebricks.compiler.api.HeuristicCompilerFactoryBuilder$1$1.optimize(HeuristicCompilerFactoryBuilder.java:90)
> 	at org.apache.asterix.api.common.APIFramework.compileQuery(APIFramework.java:268)
> 	at org.apache.asterix.aql.translator.QueryTranslator.rewriteCompileQuery(QueryTranslator.java:1938)
> 	at org.apache.asterix.aql.translator.QueryTranslator.handleQuery(QueryTranslator.java:2533)
> 	at org.apache.asterix.aql.translator.QueryTranslator.compileAndExecute(QueryTranslator.java:365)
> 	at org.apache.asterix.aql.translator.QueryTranslator.compileAndExecute(QueryTranslator.java:258)
> 	at org.apache.asterix.api.http.servlet.APIServlet.doPost(APIServlet.java:130)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
> 	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
> 	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
> 	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:224)
> 	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
> 	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
> 	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
> 	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
> 	at org.eclipse.jetty.server.Server.handle(Server.java:524)
> 	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
> 	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
> 	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
> 	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
> 	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
> 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
> 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
> 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
> 	at java.lang.Thread.run(Thread.java:745)
> Aug 12, 2016 6:33:28 PM org.apache.asterix.api.http.servlet.APIServlet doPost
> SEVERE: The input type for input argument 0(ARecord) is not expected.
> org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: The input type for
input argument 0(ARecord) is not expected.
> 	at org.apache.asterix.om.typecomputer.impl.CollectionMemberResultType.checkArgType(CollectionMemberResultType.java:40)
> 	at org.apache.asterix.om.typecomputer.base.AbstractResultTypeComputer.lambda$computeType$2(AbstractResultTypeComputer.java:39)
> 	at org.apache.asterix.om.typecomputer.base.AbstractResultTypeComputer$$Lambda$18/1226615280.checkArgTypes(Unknown
Source)
> 	at org.apache.asterix.om.typecomputer.impl.TypeComputeUtils.resolveResultType(TypeComputeUtils.java:92)
> 	at org.apache.asterix.om.typecomputer.base.AbstractResultTypeComputer.computeType(AbstractResultTypeComputer.java:39)
> 	at org.apache.asterix.dataflow.data.common.AqlExpressionTypeComputer.getTypeForFunction(AqlExpressionTypeComputer.java:80)
> 	at org.apache.asterix.dataflow.data.common.AqlExpressionTypeComputer.getType(AqlExpressionTypeComputer.java:53)
> 	at org.apache.hyracks.algebricks.core.algebra.typing.AbstractTypeEnvironment.getType(AbstractTypeEnvironment.java:45)
> 	at org.apache.hyracks.algebricks.core.algebra.operators.logical.UnnestOperator.computeOutputTypeEnvironment(UnnestOperator.java:51)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AlgebricksOptimizationContext.computeAndSetTypeEnvironmentForOperator(AlgebricksOptimizationContext.java:298)
> 	at org.apache.hyracks.algebricks.rewriter.rules.InferTypesRule.rewritePost(InferTypesRule.java:42)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:126)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:112)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.compiler.rewriter.rulecontrollers.SequentialOnceRuleController.rewriteWithRuleCollection(SequentialOnceRuleController.java:44)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.runOptimizationSets(HeuristicOptimizer.java:102)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.optimize(HeuristicOptimizer.java:82)
> 	at org.apache.hyracks.algebricks.compiler.api.HeuristicCompilerFactoryBuilder$1$1.optimize(HeuristicCompilerFactoryBuilder.java:90)
> 	at org.apache.asterix.api.common.APIFramework.compileQuery(APIFramework.java:268)
> 	at org.apache.asterix.aql.translator.QueryTranslator.rewriteCompileQuery(QueryTranslator.java:1938)
> 	at org.apache.asterix.aql.translator.QueryTranslator.handleQuery(QueryTranslator.java:2533)
> 	at org.apache.asterix.aql.translator.QueryTranslator.compileAndExecute(QueryTranslator.java:365)
> 	at org.apache.asterix.aql.translator.QueryTranslator.compileAndExecute(QueryTranslator.java:258)
> 	at org.apache.asterix.api.http.servlet.APIServlet.doPost(APIServlet.java:130)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
> 	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
> 	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
> 	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:224)
> 	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
> 	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
> 	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
> 	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
> 	at org.eclipse.jetty.server.Server.handle(Server.java:524)
> 	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
> 	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
> 	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
> 	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
> 	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
> 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
> 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
> 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
> 	at java.lang.Thread.run(Thread.java:745)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message