You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Jianfeng Jia (JIRA)" <ji...@apache.org> on 2015/11/05 23:05:27 UTC

[jira] [Created] (ASTERIXDB-1161) NullPointerException when rewriting the spatial-intersect query with an RTree index involved

Jianfeng Jia created ASTERIXDB-1161:
---------------------------------------

             Summary: NullPointerException when rewriting the spatial-intersect query with an RTree index involved
                 Key: ASTERIXDB-1161
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1161
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: Optimizer
            Reporter: Jianfeng Jia
            Assignee: Young-Seok Kim


The following AQL will throw an NPE:
-------------------------------------
drop dataverse test if exists;
create dataverse test;

use dataverse test;

create type TPoly as open{
id: int64,
geometry: polygon
}

create dataset Polygons(TPoly) primary key id;
create index geoRtree on Polygons(geometry) type rtree;

create type TSample as closed {
id : int64,
location : point
}

create dataset Sample(TSample) primary key id;

insert into dataset Polygons ( [{ "id":1, "geometry": polygon("-1.2,130.0 -214000.0,2.15 -350.0,3.6 -0.0046,4.81")}])
insert into dataset Sample ( [ {"id": 1, "location" : point("0,0")}] )

for $s in dataset Sample limit 1 return  {"ids": $s.id,
  "idp": for $p in dataset Polygons where spatial-intersect($s.location, $p.geometry) return $p.id
}
---------------------------------

NPE:
----------------------------------
java.lang.NullPointerException
        at org.apache.asterix.om.util.NonTaggedFormatUtil.isOptional(NonTaggedFormatUtil.java:96)
        at org.apache.asterix.metadata.entities.Index.getNonNullableType(Index.java:137)
        at org.apache.asterix.optimizer.rules.am.AbstractIntroduceAccessMethodRule.isMatched(AbstractIntroduceAccessMethodRule.java:323)
        at org.apache.asterix.optimizer.rules.am.AbstractIntroduceAccessMethodRule.pruneIndexCandidates(AbstractIntroduceAccessMethodRule.java:275)
        at org.apache.asterix.optimizer.rules.am.AbstractIntroduceAccessMethodRule.pruneIndexCandidates(AbstractIntroduceAccessMethodRule.java:119)
        at org.apache.asterix.optimizer.rules.am.IntroduceJoinAccessMethodRule.rewritePost(IntroduceJoinAccessMethodRule.java:140)
        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:95)
        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:87)
        at org.apache.asterix.api.common.APIFramework.compileQuery(APIFramework.java:279)
        at org.apache.asterix.aql.translator.AqlTranslator.rewriteCompileQuery(AqlTranslator.java:1900)
        at org.apache.asterix.aql.translator.AqlTranslator.handleQuery(AqlTranslator.java:2480)
        at org.apache.asterix.aql.translator.AqlTranslator.compileAndExecute(AqlTranslator.java:385)
        at org.apache.asterix.api.http.servlet.APIServlet.doPost(APIServlet.java:114)
---------------------------

However, it won't be any problem if the ddl doesn't contain a RTree index. 
E.g. if we comment out this line in the above query it will work fine.
 // create index geoRtree on Polygons(geometry) type rtree;




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