Uploaded image for project: 'Apache AsterixDB'
  1. Apache AsterixDB
  2. ASTERIXDB-1577

Confusing error message when conditions in where clause reference fields in dataset using dataset's name instead of alias

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      Master branch with latest commit id: bd3a535b171a5cc7486175

      Description

      To reproduce this issue, run the following sqlpp statements:

      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: int8
      };
      
      create dataset samptable1(samptabletype) primary key id;
      
      insert into samptable1 ({'id' : 0});
      insert into samptable1 ({'id' : 1});
      
      select id 
      from samptable1 s2 
      where samptable1.id = 1;
      
      org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Inappropriate use of function 'dataset'
      	at org.apache.asterix.runtime.evaluators.common.FunctionManagerImpl.lookupFunction(FunctionManagerImpl.java:46)
      	at org.apache.asterix.runtime.formats.NonTaggedDataFormat.resolveFunction(NonTaggedDataFormat.java:354)
      	at org.apache.asterix.jobgen.QueryLogicalExpressionJobGen.createScalarFunctionEvaluatorFactory(QueryLogicalExpressionJobGen.java:137)
      	at org.apache.asterix.jobgen.QueryLogicalExpressionJobGen.createEvaluatorFactory(QueryLogicalExpressionJobGen.java:108)
      	at org.apache.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.createEvaluatorFactory(LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.java:41)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:217)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:151)
      	at org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression.accept(ScalarFunctionCallExpression.java:55)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.changeRec(ConstantFoldingRule.java:259)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:183)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:151)
      	at org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression.accept(ScalarFunctionCallExpression.java:55)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.changeRec(ConstantFoldingRule.java:259)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:183)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:151)
      	at org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression.accept(ScalarFunctionCallExpression.java:55)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.transform(ConstantFoldingRule.java:161)
      	at org.apache.hyracks.algebricks.core.algebra.operators.logical.SelectOperator.acceptExpressionTransform(SelectOperator.java:83)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule.rewritePost(ConstantFoldingRule.java:148)
      	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.compiler.rewriter.rulecontrollers.SequentialFixpointRuleController.rewriteWithRuleCollection(SequentialFixpointRuleController.java:53)
      	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 13, 2016 2:57:29 PM org.apache.asterix.api.http.servlet.APIServlet doPost
      SEVERE: Inappropriate use of function 'dataset'
      org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Inappropriate use of function 'dataset'
      	at org.apache.asterix.runtime.evaluators.common.FunctionManagerImpl.lookupFunction(FunctionManagerImpl.java:46)
      	at org.apache.asterix.runtime.formats.NonTaggedDataFormat.resolveFunction(NonTaggedDataFormat.java:354)
      	at org.apache.asterix.jobgen.QueryLogicalExpressionJobGen.createScalarFunctionEvaluatorFactory(QueryLogicalExpressionJobGen.java:137)
      	at org.apache.asterix.jobgen.QueryLogicalExpressionJobGen.createEvaluatorFactory(QueryLogicalExpressionJobGen.java:108)
      	at org.apache.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.createEvaluatorFactory(LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.java:41)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:217)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:151)
      	at org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression.accept(ScalarFunctionCallExpression.java:55)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.changeRec(ConstantFoldingRule.java:259)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:183)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:151)
      	at org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression.accept(ScalarFunctionCallExpression.java:55)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.changeRec(ConstantFoldingRule.java:259)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:183)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:151)
      	at org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression.accept(ScalarFunctionCallExpression.java:55)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.transform(ConstantFoldingRule.java:161)
      	at org.apache.hyracks.algebricks.core.algebra.operators.logical.SelectOperator.acceptExpressionTransform(SelectOperator.java:83)
      	at org.apache.asterix.optimizer.rules.ConstantFoldingRule.rewritePost(ConstantFoldingRule.java:148)
      	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.compiler.rewriter.rulecontrollers.SequentialFixpointRuleController.rewriteWithRuleCollection(SequentialFixpointRuleController.java:53)
      	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)
      

        Attachments

          Activity

            People

            • Assignee:
              buyingyi Yingyi Bu
              Reporter:
              vignesh.raghunathan90 Vignesh Raghunathan
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: