Created
July 20, 2010 13:09
-
-
Save pingles/482934 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use '(clojure.contrib sql)) | |
(def db { | |
:classname "org.apache.hadoop.hive.jdbc.HiveDriver" | |
:subprotocol "hive" | |
:subname "//hive-server:10000/default" | |
:user "" | |
:password ""}) | |
(try | |
(with-connection db | |
(with-query-results rs ["SELECT country, keyword, COUNT(1) as cnt FROM some_clicks WHERE dated = '2010-07-16' GROUP BY country, keyword ORDER BY cnt DESC"] | |
(dorun (map #(println %) (take 25 rs))))) | |
(catch java.sql.SQLException e (println (.getMessage e)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment