Xikui Wang created ASTERIXDB-2676: ------------------------------------- Summary: Index access method ignores condition containing function calls Key: ASTERIXDB-2676 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2676 Project: Apache AsterixDB Issue Type: Improvement Components: COMP - Compiler Reporter: Xikui Wang
Given the following two datasets {code} CREATE TYPE Tweet AS OPEN { tid: bigint, area_code: string, text: string, location: point, hateful_rating: int, timestamp: datetime }; CREATE DATASET Tweets(Tweet) PRIMARY KEY tid; CREATE TYPE OfficerLocation AS OPEN { oid: bigint, location: point }; CREATE DATASET OfficerLocations(OfficerLocation) PRIMARY KEY oid; CREATE INDEX s_location ON Tweets(location) type RTREE; CREATE INDEX o_location ON OfficerLocations(location) type RTREE; {code} The 1st query won't be able to utilize index, and a user would have to explicitly create a new variable to be able to use it. The reason is in IntroduceJoinAccessMethodRule, the case in which one of the parameters is function call is ignored when considering utilize indexes. {code} SELECT t FROM Tweets t, OfficerLocations o LET area = create_circle(t.location, 100) WHERE /*+ indexnl */ spatial_intersect(area, o.location) AND is_new(t) AND is_new(o); {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)