Hi John,
I verified that the sum(req) column's name is _2 in this case. The
columns names from the returned table are correctly getting printed
as shown in logs.
Pls find below the code and the data to reproduce the problem:
command to load data:
ardea -t test.csv -m "d1:k,d2:k,m1:d,m2:i,m3:i" -d test
cheers,
gaurav
On Sat, Jul 7, 2012 at 2:28 AM, K. John Wu <[email protected]> wrote:
> Hi, Gaurav,
>
> Would you mind try to give sum(req) a name through something like
> "sum(req) as s"?
>
> I suspect that the name for "sum(req)" should be _3 not _2. The
> expression _2 might have been translated to "site" which might be a
> string valued column. An attempt to perform sum over string values
> could cause serious problems.
>
> If you could, would you mind pack the test data and the test program
> for me? I could take a more careful look at it.
>
> John
>
>
> On 7/6/12 1:46 PM, Gaurav Agarwal wrote:
>> Hi John,
>>
>> I think I may have come across another problem - I issued a select
>> query on ibis:table and then tried to issue another select query on
>> the table returned from the first query. The second query on
>> ibis::bord class seems to not return any result if I put any where
>> condition. Am pasting the simple code snippet and the console output
>> at log level 2. Please take a look at it sometime to see if I am doing
>> something wrong.
>>
>> cheers,
>> gaurav
>>
>>
>> #include <iostream>
>> #include "ibis.h"
>>
>> using namespace std;
>> int main() {
>> ibis::gVerbose = 2;
>> ibis::init();
>> ibis::util::logger lg;
>> ibis::partList parts;
>> string s("/Users/gaurav/Downloads/ecpm");
>> ibis::table * table = ibis::table::create(s.c_str());
>> ibis::table* table_select = table->select("pub,site, sum(req)","(pub
>> = 'redex') ");
>> table_select->dump(lg(), ",");
>> ibis::table::stringList cols = table_select->columnNames();
>> lg() << "~~~~~~~~~~~~~~~~~~~~~~~~~" <<endl;
>> lg() << cols;
>> ibis::table* table_select2 =
>> table_select->select("pub,sum(_2)","(pub = 'redex') ");
>> table_select2->dump(lg(), ",");
>> delete table_select2;
>> delete table_select;
>> delete table;
>> }
>>
>>
>> Gauravs-MacBook-Pro:src gaurav$ ./a.out
>>
>> FastBit ibis1.3.0.3
>> Log messages started on Sat Jul 7 02:14:09 2012
>> util::gatherParts -- examining /Users/gaurav/Downloads/ecpm
>> index = <binning none/><encoding equality/>
>>
>> Constructed a part named ecpm
>> activeDir = "/Users/gaurav/Downloads/ecpm"
>> 22005171 rows and 5 columns
>> mensa -- constructed table T-ecpm (/Users/gaurav/Downloads/ecpm) from
>> directory /Users/gaurav/Downloads/ecpm. It consists of 1 partition
>> with 5 columns and 22005171 rows
>> countQuery::setWhereClause accepted new query conditions "pub == "redex""
>> Constructed in-memory data partition wzb7L -- filter::sift2(SELECT
>> pub,site, sum(req) FROM 1 data partition WHERE pub == ...) -- with 3
>> columns
>> filter::sift2(SELECT pub,site, sum(req) FROM 1 data partition WHERE
>> pub == ...) -- processing data partition ecpm
>> countQuery assigned data partition ecpm
>> countQuery::evaluate -- Select count(*) From ecpm Where pub == "redex" -->
>> 2858
>> countQuery::evaluate -- duration: 0.001297 sec(CPU), 0.001297 sec(elapsed)
>> Constructed in-memory data partition _ARzQ -- GROUP BY pub, site,
>> SUM(req) on table wzb7L -- with 2 rows and 3 columns
>> filter::sift2(SELECT pub,site, sum(req) FROM 1 data partition WHERE
>> pub == ...) -- duration: 0.23132 sec(CPU), 0.231337 sec(elapsed)
>> countQuery::setWhereClause accepted new query conditions "pub == "redex""
>> Constructed in-memory data partition wgrF1 -- filter::sift2(SELECT
>> pub,sum(_2) FROM 1 data partition WHERE pub == ...) -- with 2 columns
>> filter::sift2(SELECT pub,sum(_2) FROM 1 data partition WHERE pub ==
>> ...) -- processing data partition _ARzQ
>> countQuery assigned data partition _ARzQ
>> countQuery::evaluate -- Select count(*) From _ARzQ Where pub == "redex" --> 0
>> countQuery::evaluate -- duration: 3.4e-05 sec(CPU), 3.48091e-05 sec(elapsed)
>> filter::sift2(SELECT pub,sum(_2) FROM 1 data partition WHERE pub ==
>> ...) -- duration: 0.000129 sec(CPU), 0.000128984 sec(elapsed)
>> "redex","Freezaholic",0
>> "redex","vikingRDK",0
>> ~~~~~~~~~~~~~~~~~~~~~~~~~
>> pubsite_2
>> _______________________________________________
>> FastBit-users mailing list
>> [email protected]
>> https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users
>>
>
"redex","vikingRDK",0,0,0
"redex","Freezaholic",0,0,0
"redex","vikingRDK",0,0,0
"redex","Freezaholic",0,0,0
"redex","vikingRDK",0,0,0
"redex","Freezaholic",0,0,0
"redex","vikingRDK",0,0,0
"redex","Freezaholic",0,0,0
"redex","vikingRDK",0,0,0
"redex","Freezaholic",0,0,0
"-","Dot empire",0.919,178,37
"d","lagu2",9.965,1053,1027
"fb","Facebooker",0,0,0
"fz","Free downloads",0,0,0
"no","Sexmob",0,0,0
"BCE","softwares",0.286,1110237,176527
"N/A","Tw33t",0,0,0
"N/A","yourmobi",0.376,535108,447211
"W2C","Wap2Chat",0.077,932693,177561
#include <iostream>
#include "ibis.h"
using namespace std;
int main() {
ibis::gVerbose = 2;
ibis::init();
ibis::util::logger lg;
ibis::partList parts;
string s("/Users/gaurav/Downloads/data/test");
ibis::table * table = ibis::table::create(s.c_str());
ibis::table* table_select = table->select("d1,d2, sum(m1)","(d1 = 'redex') ");
table_select->dump(lg(), ",");
ibis::table::stringList cols = table_select->columnNames();
lg() << "~~~~~~~~~~~~~~~~~~~~~~~~~" <<endl;
lg() << cols;
ibis::table* table_select2 = table_select->select("d1,sum(_2)","(d1 = 'redex') ");
table_select2->dump(lg(), ",");
delete table_select2;
delete table_select;
delete table;
}
_______________________________________________
FastBit-users mailing list
[email protected]
https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users