namhnguyen / asterixdb

Automatically exported from code.google.com/p/asterixdb
0 stars 0 forks source link

Query populates field as an ordered list instead instead of an unordered list #394

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start asterix using managix
2. Navigate to web-url and execute the following:-

a) 
drop dataverse TinySocial if exists;
create dataverse TinySocial;
use dataverse TinySocial;

create type TwitterUserType as open {
        screen-name: string,
        lang: string,
        friends_count: int32,
        statuses_count: int32,
        name: string,
        followers_count: int32
}

create type TweetMessageType as closed {
        tweetid: string,
        user: TwitterUserType,
        sender-location: point?,
        send-time: datetime,
        referred-topics: {{ string }},
        message-text: string
}

create type EmploymentType as open {
        organization-name: string,      
        start-date: date,
        end-date: date?
}

create type FacebookUserType as closed {
        id: int32,
        alias: string,
        name: string,
        user-since: datetime,
        friend-ids: {{ int32 }},
        employment: [EmploymentType]
}

create type FacebookMessageType as closed {
        message-id: int32,
        author-id: int32,
        in-response-to: int32?,
        sender-location: point?,
        message: string
}

b) use dataverse TinySocial;

create dataset FacebookUsers(FacebookUserType)
primary key id;

create dataset FacebookMessages(FacebookMessageType)
primary key message-id;

create dataset TwitterUsers(TwitterUserType)
primary key screen-name;

create dataset TweetMessages(TweetMessageType)
primary key tweetid
hints(cardinality=100); 

create index fbUserSinceIdx on FacebookUsers(user-since);
create index fbAuthorIdx on FacebookMessages(author-id) type btree;
create index fbSenderLocIndex on FacebookMessages(sender-location) type rtree;
create index fbMessageIdx on FacebookMessages(message) type keyword;

c) load data from 
Twitter Users: http://asterixdb.googlecode.com/files/twu.adm
Tweet Messages: http://asterixdb.googlecode.com/files/twm.adm
Facebook Users:http://asterixdb.googlecode.com/files/fbu.adm
Facebook Messages: http://asterixdb.googlecode.com/files/fbm.adm

d) 

use dataverse demo;

for $t in dataset('TweetMessages') 
where 
$t.send-time >= datetime('2012-08-12T17:00:00') and 
$t.send-time <= datetime('2012-08-14T17:00:00') 

return { 
"screen-name": $t.user.screen-name, 
"message": $t.message-text, 
"prev-messages": 
             for $t2 in dataset('TweetMessages') 
             where $t2.send-time >= datetime('2011-08-12T17:00:00') and 
             $t2.send-time <= datetime('2011-08-14T17:00:00') and 
             $t.user.screen-name = $t2.user.screen-name 
             return { "msgtxt":$t2.message-text} 
}

Sample record in result:-
{ "screen-name": "DonetteHouser$379", "message": " hate samsung its wireless is 
terrible", "prev-messages": [ { "msgtxt": " dislike verizon the 3G is 
terrible:(" }, { "msgtxt": " hate sprint the shortcut-menu is bad:(" }, { 
"msgtxt": " dislike sprint its signal is terrible:(" } ] }

Above, the field prev-messages is populated as an ordered list. 

What is the expected output? What do you see instead?
Above, the field prev-messages should be a bag (unordered list). 

Please use labels and text to provide additional information.
observed on asterix_lsm_stabilization

Original issue reported on code.google.com by RamanGro...@gmail.com on 26 Apr 2013 at 8:52

GoogleCodeExporter commented 9 years ago

Original comment by khfaraaz82 on 26 Apr 2013 at 10:49

GoogleCodeExporter commented 9 years ago

Original comment by vinay...@gmail.com on 24 May 2013 at 8:49

GoogleCodeExporter commented 9 years ago
Based on Vinayak's suggestions, we should always return OrderedList because 
OrderedList is a "subclass" of UnorderedList.  So this issue is by-design. But 
we need to clearly document that and this issue becomes a documentation issue.

Original comment by buyingyi@gmail.com on 30 May 2013 at 12:11

GoogleCodeExporter commented 9 years ago
I don't think this is "by design" - or that we "should" do this - I thought the 
argument is that "it's not wrong".  There's a pretty big difference - the tone 
of the documentation would reflect that.  @Vinayak:  Which is is?  (Thx.)

Original comment by dtab...@gmail.com on 30 May 2013 at 7:06