Guest User

Untitled

a guest
Jul 6th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (ns clive.core
  2.   (:import [org.apache.hadoop.hive.service HiveClient]
  3.            [org.apache.thrift.transport TSocket]
  4.            [org.apache.thrift.protocol TBinaryProtocol]))
  5.  
  6. (defn hive-socket
  7.   [host port]
  8.   (doto (TSocket. host port) .open))
  9.  
  10. (defn hive-client
  11.   [socket]
  12.   (HiveClient. (TBinaryProtocol. socket)))
  13.  
  14. (defn -main
  15.   [& args]
  16.   (with-open [sock (hive-socket "b57" 10000)]
  17.     (let [client (hive-client sock)
  18.           result (.execute client "describe deals_production_people")]
  19.           (.fetchAll result))))
Add Comment
Please, Sign In to add comment