You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Taewoo Kim (JIRA)" <ji...@apache.org> on 2018/09/24 21:00:00 UTC

[jira] [Closed] (ASTERIXDB-2437) Index-only plan cannot be generated for a composite index if both fields are used and only one field is returned.

     [ https://issues.apache.org/jira/browse/ASTERIXDB-2437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Taewoo Kim closed ASTERIXDB-2437.
---------------------------------
    Resolution: Fixed

> Index-only plan cannot be generated for a composite index if both fields are used and only one field is returned.
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: ASTERIXDB-2437
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2437
>             Project: Apache AsterixDB
>          Issue Type: Bug
>            Reporter: Taewoo Kim
>            Assignee: Taewoo Kim
>            Priority: Major
>
> When there is a composite index,  if both fields are used in the select condition and only one field is returned, the compiler generates an exception.
>  
> DDL and query:
> {code:java}
> drop dataverse twitter if exists;
> create dataverse twitter if not exists;
> use twitter;
> create type typeUser if not exists as open {
>     id: int64,
>     name: string,
>     screen_name : string,
>     profile_image_url : string,
>     lang : string,
>     location: string,
>     create_at: date,
>     description: string,
>     followers_count: int32,
>     friends_count: int32,
>     statues_count: int64
> };
> create type typePlace if not exists as open{
>     country : string,
>     country_code : string,
>     full_name : string,
>     id : string,
>     name : string,
>     place_type : string,
>     bounding_box : rectangle
> };
> create type typeGeoTag if not exists as open {
>     stateID: int32,
>     stateName: string,
>     countyID: int32,
>     countyName: string,
>     cityID: int32?,
>     cityName: string?
> };
> create type typeTweet if not exists as open {
>     create_at : datetime,
>     id: int64,
>     text: string,
>     in_reply_to_status : int64,
>     in_reply_to_user : int64,
>     favorite_count : int64,
>     coordinate: point?,
>     retweet_count : int64,
>     lang : string,
>     is_retweet: boolean,
>     hashtags : {{ string }} ?,
>     user_mentions : {{ int64 }} ? ,
>     user : typeUser,
>     place : typePlace?,
>     geo_tag: typeGeoTag
> };
> create dataset ds_tweet(typeTweet) if not exists primary key id;
> create index create_at_status_count_idx on ds_tweet(user.create_at, user.statues_count);
> select value count(first.create_at) from (
> select t.user.create_at, t.user.statues_count, t.id from ds_tweet t
> where
>       t.user.create_at   >=
>       date_from_unix_time_in_days(10000) and
>       t.user.create_at   <
>       date_from_unix_time_in_days(12000) and
>           t.user.statues_count  >= 0 and
>           t.user.statues_count  <  1000000
> ) first;
> {code}
>  
> Exception:
> {code:java}
> org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Could not infer type for variable '$$57'.
> at org.apache.asterix.optimizer.rules.SetClosedRecordConstructorsRule$SettingClosedRecordVisitor.visitVariableReferenceExpression(SetClosedRecordConstructorsRule.java:170) ~[asterix-algebra-0.9.4-SNAPSHOT.jar:0.9.4-SNAPSHOT]
> at org.apache.asterix.optimizer.rules.SetClosedRecordConstructorsRule$SettingClosedRecordVisitor.visitVariableReferenceExpression(SetClosedRecordConstructorsRule.java:77) ~[asterix-algebra-0.9.4-SNAPSHOT.jar:0.9.4-SNAPSHOT]
> at org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression.accept(VariableReferenceExpression.java:93) ~[algebricks-core-0.3.4-SNAPSHOT.jar:0.3.4-SNAPSHOT]
> at org.apache.asterix.optimizer.rules.SetClosedRecordConstructorsRule$SettingClosedRecordVisitor.visitFunctionCallExpression(SetClosedRecordConstructorsRule.java:150) ~[asterix-algebra-0.9.4-SNAPSHOT.jar:0.9.4-SNAPSHOT]
> at org.apache.asterix.optimizer.rules.SetClosedRecordConstructorsRule$SettingClosedRecordVisitor.visitFunctionCallExpression(SetClosedRecordConstructorsRule.java:77) ~[asterix-algebra-0.9.4-SNAPSHOT.jar:0.9.4-SNAPSHOT]
> at org.apache.hyracks.algebricks.core.algebra.visitors.AbstractConstVarFunVisitor.visitScalarFunctionCallExpression(AbstractConstVarFunVisitor.java:39) ~[algebricks-core-0.3.4-SNAPSHOT.jar:0.3.4-SNAPSHOT]
> at org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression.accept(ScalarFunctionCallExpression.java:55) ~[algebricks-core-0.3.4-SNAPSHOT.jar:0.3.4-SNAPSHOT]
> at org.apache.asterix.optimizer.rules.SetClosedRecordConstructorsRule$SettingClosedRecordVisitor.visitFunctionCallExpression(SetClosedRecordConstructorsRule.java:150) ~[asterix-algebra-0.9.4-SNAPSHOT.jar:0.9.4-SNAPSHOT]
> at org.apache.asterix.optimizer.rules.SetClosedRecordConstructorsRule$SettingClosedRecordVisitor.visitFunctionCallExpression(SetClosedRecordConstructorsRule.java:77) ~[asterix-algebra-0.9.4-SNAPSHOT.jar:0.9.4-SNAPSHOT]
> at org.apache.hyracks.algebricks.core.algebra.visitors.AbstractConstVarFunVisitor.visitScalarFunctionCallExpression(AbstractConstVarFunVisitor.java:39) ~[algebricks-core-0.3.4-SNAPSHOT.jar:0.3.4-SNAPSHOT]
> at org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression.accept(ScalarFunctionCallExpression.java:55) ~[algebricks-core-0.3.4-SNAPSHOT.jar:0.3.4-SNAPSHOT]
> at org.apache.asterix.optimizer.rules.SetClosedRecordConstructorsRule$SettingClosedRecordVisitor.transform(SetClosedRecordConstructorsRule.java:91) ~[asterix-algebra-0.9.4-SNAPSHOT.jar:0.9.4-SNAPSHOT]
> at org.apache.hyracks.algebricks.core.algebra.operators.logical.SelectOperator.acceptExpressionTransform(SelectOperator.java:83) ~[algebricks-core-0.3.4-SNAPSHOT.jar:0.3.4-SNAPSHOT]
> at org.apache.asterix.optimizer.rules.SetClosedRecordConstructorsRule.rewritePost(SetClosedRecordConstructorsRule.java:70) ~[asterix-algebra-0.9.4-SNAPSHOT.jar:0.9.4-SNAPSHOT]{code}
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)