[ 
https://issues.apache.org/jira/browse/ASTERIXDB-2394?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16505037#comment-16505037
 ] 

ASF subversion and git services commented on ASTERIXDB-2394:
------------------------------------------------------------

Commit e7422b0eee70185e7e769044c693d57232f73af8 in asterixdb's branch 
refs/heads/master from [~idleft]
[ https://git-wip-us.apache.org/repos/asf?p=asterixdb.git;h=e7422b0 ]

[ASTERIXDB-2394][COMP] Align VarCounter in query rewritting

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
Currently, before we do certain language rewritings, we take a snapshot
of the var counter in the context and pass it to the rewriter. This
works fine in most of the cases, but it can fail when the rewriter
introduces new variables. This will cause different variables map to the
same variable id. Although this error may be fixed by another
ScopingVisitor, the compiler could fail if there is no more visitor down
in the rewriting workflow.

Change-Id: I8ea1ee7de140d6556af03f07a5ec7bc278b011ba
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2673
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dmitry.lycha...@couchbase.com>


> Variable substitution exception in SQLPP function
> -------------------------------------------------
>
>                 Key: ASTERIXDB-2394
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2394
>             Project: Apache AsterixDB
>          Issue Type: Bug
>            Reporter: Xikui Wang
>            Assignee: Xikui Wang
>            Priority: Major
>
> Given query cannot be executed as in a function body, but can be executed as 
> a plain query. There is some issue with the variable counter in the language 
> rewriting process which causes different variables has the same varId. This 
> further causes mappings are overwritten in the variable substitution phase.
> {code}
> use Starbucks;
> create function StarbucksFriends(user_id){
> (
>     select * from Starbucks sb, (select * from Tweets tw
>     let dumb = (select * from Tweets f where f.user.id_str in (select value 
> fw.followers from Followers fw where fw.twitter_id= user_id ))
>     where tw.user.id_str = user_id) t
>     order by spatial_distance(sb.location,create_point(0,0)) limit 1
> )
> };
> use Starbucks;
> StarbucksFriends("123");
> use Starbucks;
> select * from Starbucks sb, (select * from Tweets tw
>     let dumb = (select * from Tweets f where f.user.id_str in (select value 
> fw.followers from Followers fw where fw.twitter_id= "123" ))
>     where tw.user.id_str = "123") t
>     order by spatial_distance(sb.location,create_point(0,0)) limit 1;
> {code}



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

Reply via email to