Forum: Building VoltDB Applications

Post: Twitter Example Application

Twitter Example Application
tcallaghan
Jun 8, 2010
This example application uses the Twitter API to monitor a stream of tweets and parse out hashtags. Hashtag trends are calculated and made available via a web interface. It will be included in the next VoltDB kit.
Important Notes:
- you MUST change the Twitter username and password to your own valid credentials for this application to work.
- runs on VoltDB v1.0.01 and above.
- must be installed into your kit's "examples" folder (alongside "auction", "helloworld", and "satellite") to run as-is.
- modify location of voltdb*.jar and "-Djava.library.path" to run from other locations.
Download Twitter Example Application
why sort in java?
skashikar
Jun 10, 2010
Hi,

In the Twitter example's Select.java the hashtags are sorted outside select statement.
Sorry if this is dumb, but it's not clear to me why not do it in select query itself ?
"ORDER BY hashcount, hashtag"

Thanks,
Swapnil
Re: why sort in java? Hi Swapnil,
edmazur
Jun 10, 2010
Hi,

In the Twitter example's Select.java the hashtags are sorted outside select statement.
Sorry if this is dumb, but it's not clear to me why not do it in select query itself ?
"ORDER BY hashcount, hashtag"

Thanks,
Swapnil


That's a very good question, thanks for asking. VoltDB does not currently support ORDER BY with expressions (see ENG-282). You are right that it would make the most sense to do this inside the query itself.

You may have also noticed in Select.java that it is a single-partition transaction. If you look inside DB.java, the application is actually looping over all partitions and firing off the SELECT query to each. Because Select.java applies the sort and limit locally, this cuts down on the amount of data sent back to the client. Once data from all partitions has been retrieved by the client, a final sort and limit is applied.

Ed
that explains it
skashikar
Jun 14, 2010
That's a very good question, thanks for asking. VoltDB does not currently support ORDER BY with expressions (see ENG-282). You are right that it would make the most sense to do this inside the query itself...

Ed


Hi Ed,

Thanks. That explains it - ORDER BY issue is also preventing use of SQL LIMIT clause, otherwise, ideally both sorting and local limit can be handled within SQL.

I will keep an eye on ENG-282.

-Swapnil
For Swapnil and anyone else
edmazur
Sep 1, 2010
Hi Ed,

Thanks. That explains it - ORDER BY issue is also preventing use of SQL LIMIT clause, otherwise, ideally both sorting and local limit can be handled within SQL.

I will keep an eye on ENG-282.

-Swapnil

For Swapnil and anyone else that was watching this, ENG-282 has been fixed and the Twitter sample app is now updated to reflect this.