asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jianfeng Jia (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ASTERIXDB-1205) Union should also work for the temporary list variables.
Date Mon, 30 Nov 2015 23:43:11 GMT
Jianfeng Jia created ASTERIXDB-1205:
---------------------------------------

             Summary: Union should also work for the temporary list variables. 
                 Key: ASTERIXDB-1205
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1205
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: Operators, Optimizer
            Reporter: Jianfeng Jia


This issue is from a discussion in the dev mail list. 
The following query union two temporary list, but ends up a exception:
{code}
let $aa := [{"fa":1, "fb":1}, {"fa":2, "fb":1}]
let $bb := [{"fa":1, "fb":1}, {"fa":2, "fb":1}]
let $ccc := $aa union $bb
for $tt in $ccc return $tt;
{code}
org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Inappropriate use of
function 'union'
  at org.apache.asterix.runtime.evaluators.common.FunctionManagerImpl.lookupFunction(FunctionManagerImpl.java:46)
  at org.apache.asterix.runtime.formats.NonTaggedDataFormat.resolveFunction(NonTaggedDataFormat.java:894)
  at org.apache.asterix.jobgen.QueryLogicalExpressionJobGen.createScalarFunctionEvaluatorFactory(QueryLogicalExpressionJobGen.java:148)
  at org.apache.asterix.jobgen.QueryLogicalExpressionJobGen.createEvaluatorFactory(QueryLogicalExpressionJobGen.java:113)
  at org.apache.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.createEvaluatorFactory(LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.java:57)
  at org.apache.hyracks.algebricks.core.algebra.operators.physical.AssignPOperator.contributeRuntimeOperator(AssignPOperator.java:84)
  at org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator.contributeRuntimeOperator(AbstractLogicalOperator.java:162)
  at org.apache.hyracks.algebricks.core.jobgen.impl.PlanCompiler.compileOpRef(PlanCompiler.java:98)
  at org.apache.hyracks.algebricks.core.jobgen.impl.PlanCompiler.compileOpRef(PlanCompiler.java:85)
  at org.apache.hyracks.algebricks.core.jobgen.impl.PlanCompiler.compileOpRef(PlanCompiler.java:85)
  at org.apache.hyracks.algebricks.core.jobgen.impl.PlanCompiler.compileOpRef(PlanCompiler.java:85)
  at org.apache.hyracks.algebricks.core.jobgen.impl.PlanCompiler.compileOpRef(PlanCompiler.java:85)
  at org.apache.hyracks.algebricks.core.jobgen.impl.PlanCompiler.compilePlan(PlanCompiler.java:61)
  at org.apache.hyracks.algebricks.compiler.api.HeuristicCompilerFactoryBuilder$1$1.createJob(HeuristicCompilerFactoryBuilder.java:104)
  at org.apache.asterix.api.common.APIFramework.compileQuery(APIFramework.java:359)
  at org.apache.asterix.aql.translator.QueryTranslator.rewriteCompileQuery(QueryTranslator.java:1896)
  at org.apache.asterix.aql.translator.QueryTranslator.handleQuery(QueryTranslator.java:2470)
  at org.apache.asterix.aql.translator.QueryTranslator.compileAndExecute(QueryTranslator.java:384)
  at org.apache.asterix.api.http.servlet.APIServlet.doPost(APIServlet.java:148)
  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)
The query plan is following:
{code}
-- DISTRIBUTE_RESULT  |UNPARTITIONED|
  exchange 
  -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
    project ([$$9])
    -- STREAM_PROJECT  |UNPARTITIONED|
      unnest $$9 <- function-call: asterix:scan-collection, Args:[%0->$$8]
      -- UNNEST  |UNPARTITIONED|
        assign [$$8] <- [function-call: asterix:union, Args:[function-call: asterix:ordered-list-constructor,
Args:[function-call: asterix:open-record-constructor, Args:[AString: {fa}, AInt64: {1}, AString:
{fb}, AInt64: {1}], function-call: asterix:open-record-constructor, Args:[AString: {fa}, AInt64:
{2}, AString: {fb}, AInt64: {1}]], function-call: asterix:ordered-list-constructor, Args:[function-call:
asterix:open-record-constructor, Args:[AString: {fa}, AInt64: {1}, AString: {fb}, AInt64:
{1}], function-call: asterix:open-record-constructor, Args:[AString: {fa}, AInt64: {2}, AString:
{fb}, AInt64: {1}]]]]
        -- ASSIGN  |UNPARTITIONED|
          empty-tuple-source
          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|

{code}

If the data are coming from the datasets in storage, then it will work fine. Though, it gives
a different query plan:
{code}
-- DISTRIBUTE_RESULT  |PARTITIONED|
  exchange
  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
    union ($$0, $$2, $$5)
    -- UNION_ALL  |PARTITIONED|
      exchange
      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
        project ([$$0])
        -- STREAM_PROJECT  |PARTITIONED|
          exchange 
          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
            data-scan []<-[$$13, $$0] <- test:ds_1
            -- DATASOURCE_SCAN  |PARTITIONED|
              exchange 
              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                empty-tuple-source
                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
      exchange 
      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
        project ([$$2])
        -- STREAM_PROJECT  |PARTITIONED|
          exchange 
          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
            data-scan []<-[$$14, $$2] <- test:ds_2
            -- DATASOURCE_SCAN  |PARTITIONED|
              exchange 
              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                empty-tuple-source
                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
{code}
So there should be two different union functions, or we should update the query plan to use
the same union operator? 



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

Mime
View raw message