Hi, Teryl, The names such as "COUNT(*)" has to be changed in order to accommodate later queries. The main problem is that "COUNT(*)" will not be recognized as a column name if it appears in a later query. Because of this, names such as "COUNT(*)" has been changed to something like 'count0' if the user has not provided an aliases for "COUNT(*)" already. To provide an alias for an operation, do something like
sGroupByClause = "v4sIP, v4diP, SUM(Flows) as sum_flow"; instead of sGroupByClause = "v4sIP, v4diP, SUM(Flows)"; John On 6/24/2010 10:44 AM, Teryl Taylor wrote: > It looks this was changed recently. Saw this in an earlier post on the > mail list. You recommend using aliasing to control the names. > > So, my question is, how do I get the alias of the SUM(Flows) parameter > in the select clause, so that I can match it up with a column from the > returned table? > > I want to preserve the order of the columns in the select clause. > > Cheers, > > Teryl > > > On Thu, Jun 24, 2010 at 2:05 PM, Teryl Taylor <[email protected] > <mailto:[email protected]>> wrote: > > Hi John, > > I'm getting some weird behaviour in the latest build, that I didn't > seen in the release of 1.1.6. I'm trying to do a select and then > a groupby... > > The select looks something like this: select v4sIP, v4dIP, Flows, > time where Protocol=6 AND v4sIP=192.168.20.163 > > And the group by is like this: > > v4sIP, v4diP, SUM(Flows) > > > Now off of the group by table, that I create, I try to get the > column names to print them out by doing the following: > > ibis::table* gb = sel1->groupby(sGroupByClause.c_str()); > if(gb == 0) > { > cout << "GROUP BY Clause: " << sGroupByClause << " > failed." << endl; > } > printf("The groupby clause is %s\n", sGroupByClause.c_str()); > ibis::selectClause gc(sGroupByClause.c_str()); > > ibis::table::stringList col = gb->columnNames(); > ibis::table::typeList types = gb->columnTypes(); > hash_map<std::string, ibis::TYPE_T> typeMap; > for(int i = 0; i < gb->nColumns(); i++) > { > typeMap[string(col[i])] = types[i]; > printf("Column name: %s, Type: %d\n", col[i], types[i]); > } > > > In the latest version this prints out as: > > Column name: count0, Type: 7 > Column name: sum3, Type: 11 > Column name: v4diP, Type: 7 > Column name: v4sIP, Type: 7 > > > Under the old version 1.16...the names are: > > the column name is COUNT(*) > the column name is SUM(Flows) > the column name is v4dIP > the column name is v4sIP > > > So my question is, what's changed that has caused the difference in > the naming convention? I'm trying to use the select clause to pick > out columns from the table in the order they were presented in the > select clause. However, the column name in the table, and the > column name in the select clause are now different, so I can't do that. > > What's my best option? > > Cheers, > > Teryl > > > > > _______________________________________________ > FastBit-users mailing list > [email protected] > https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users _______________________________________________ FastBit-users mailing list [email protected] https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users
