Golang Thrift Hive

package main


import (
    hive "github.com/araddon/hive"
    "log"
    "fmt"
)


func init() {
    hive.MakePool("localhost:10000")
}


func main() {


    conn, err := hive.GetHiveConn()
    if err == nil {


        er, err := conn.Client.Execute("select * from tb where date='2016-09-09' limit 10")
        if er == nil && err == nil {
            for {
                row, _, _ := conn.Client.FetchOne()
                if len(row) > 0 { 
                    fmt.Println(row)
                } else {
                    return
                }   
            }   
        } else {
            log.Println(er, err)
        }   
    }   
    if conn != nil {
        // make sure to check connection back into pool
        conn.Checkin()
    }   
}

发布了145 篇原创文章 · 获赞 17 · 访问量 23万+

猜你喜欢

转载自blog.csdn.net/guichenglin/article/details/52808196