deniskuzZ commented on code in PR #4566:
URL: https://github.com/apache/hive/pull/4566#discussion_r1418958428
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -470,28 +320,29 @@ private boolean checkIfTableIsUsable(String tableName,
boolean configValue) thro
// don't check it if disabled
return false;
}
- Connection dbConn = null;
- boolean tableExists = true;
+ jdbcResource.bindDataSource(POOL_TX);
try {
- dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED);
- try (Statement stmt = dbConn.createStatement()) {
- // Dummy query to see if table exists
- try (ResultSet rs = stmt.executeQuery("SELECT 1 FROM \"" + tableName +
"\"")) {
- rs.next();
- }
- }
- } catch (SQLException e) {
+ jdbcResource.getJdbcTemplate().query("SELECT 1 FROM \"" + tableName +
"\"", new MapSqlParameterSource(),
+ rs -> {
+ if (rs.next()) {
+ return rs.getInt(1);
+ }
+ return -1;
Review Comment:
-1 would be cast to false?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]