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

Variable substitution exception in SQLPP function

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.4
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      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.

      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;
      

        Attachments

          Activity

            People

            • Assignee:
              idleft Xikui Wang
              Reporter:
              idleft Xikui Wang
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: