有没有办法通过jdbc使impala上的元数据失效?
我尝试了以下方法(我使用的是cloudera\u impalajdbc4\u 2.5.5.1007驱动程序):
// invalidate metadata and rebuild index on Impala
try {
Statement stmt = impalaConn.createStatement();
try {
String query = "INVALIDATE METADATA;";
ResultSet resultSet = stmt.executeQuery(query);
while (resultSet.next()) {
// do something
}
}
finally {
stmt.close();
}
}
catch(SQLException ex) {
while (ex != null)
{
ex.printStackTrace();
ex = ex.getNextException();
}
System.exit(1);
}
但我有以下例外:
java.sql.SQLDataException: [Simba][JDBC](11300) A ResultSet was expected but not generated from query "INVALIDATE METADATA;". Query not executed.
at com.cloudera.impala.exceptions.ExceptionConverter.toSQLException(ExceptionConverter.java:136)
at com.cloudera.impala.jdbc.common.SStatement.checkCondition(SStatement.java:2274)
at com.cloudera.impala.jdbc.common.SStatement.executeNoParams(SStatement.java:2704)
at com.cloudera.impala.jdbc.common.SStatement.executeQuery(SStatement.java:880)
at ico.az.deploy.TestSuite.testTeradata(TestSuite.java:103)
at ico.az.deploy.TestSuite.run(TestSuite.java:310)
at ico.az.deploy.TestSuite.main(TestSuite.java:345)
你知道吗?
1条答案
按热度按时间yeotifhr1#
对。该查询不返回
ResultSet
. 使用Statement.executeUpdate(String)
相反。正如javadoc所指出的,为强调而加上粗体,它执行给定的sql语句,可以是insert、update或delete语句,也可以是不返回任何内容的sql语句。