java - Hive Table is Empty check -


how can check if particular table table empty in hive.i need store boolean value variable in java code.i tried

statement stmt = con.createstatement();      stmt.execute("select count(*) "+tablename);     int ct = stmt.getupdatecount();     logger.info("hive table count " +ct);     if(ct > 0)       return false;     else      return true; 

but doesnot seem work. suggestions ?

try this:

    statement stmt = con.createstatement();     resultset rs = stmt.executequery("select count(*) "+tablename);     int ct = rs.getint(0);     logger.info("hive table count " +ct);     if(ct > 0)       return false;     else      return true; 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -