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

Extract common expr should not be applied to JOIN

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.9.4
    • 0.9.4.2
    • None
    • None

    Description

      drop dataverse Coffee if exists;
      create dataverse Coffee;
      use Coffee;
      
      
      create type CoffeeType as {
          id: string,
          location: point
      };
      
      create type FollowersType as {
          user_id: string,
          twitter_id: string,
          followers: [string]
      };
      
      create dataset Coffee(CoffeeType)
          primary key id;
      
      create dataset Followers(FollowersType)
          primary key user_id;
      
      
      create type CoffeeUser as closed {
          id: int64,
          id_str: string
      };
      
      create type Tweet as open {
          id: int64,
          user: CoffeeUser,
          timestamp_ms: string
      };
      
      create dataset Tweets (Tweet)
      primary key id;
      
      
      select * from Tweets t
      let followers = (select * from Tweets f where spatial_intersect(create_circle(create_point(f.place.bounding_box.coordinates[0][0][0],f.place.bounding_box.coordinates[0][0][1]),5.0),
      create_circle(create_point(t.place.bounding_box.coordinates[0][0][0],t.place.bounding_box.coordinates[0][0][1]),5.0))),
      sb = (select value s.location from Coffee s where spatial_intersect(create_circle(create_point(t.place.bounding_box.coordinates[0][0][0],t.place.bounding_box.coordinates[0][0][1]),5.0),s.location));
      

      The above query wouldn't work as the ExtractCommonExpressionsRule extracts the common exprs in the two LeftOutterJoin operators and pulls the join condition in the second op. Let alone this is wrong for the LOJ case, the cost for adding cartesian product is much higher than evaluating the same expr. twice. This should be fixed.

      Attachments

        Activity

          People

            dlychagin-cb Dmitry Lychagin
            idleft Xikui Wang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: