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

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

php - Redirect and hide target URL -