veghlaci05 commented on code in PR #3513:
URL: https://github.com/apache/hive/pull/3513#discussion_r951236348
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java:
##########
@@ -229,17 +231,33 @@ public CompactionInfo
findNextToCompact(FindNextCompactRequest rqst) throws Meta
}
Connection dbConn = null;
- Statement stmt = null;
+ PreparedStatement stmt = null;
//need a separate stmt for executeUpdate() otherwise it will close the
ResultSet(HIVE-12725)
Statement updStmt = null;
ResultSet rs = null;
+
+ long poolTimeout = MetastoreConf.getTimeVar(conf,
ConfVars.COMPACTOR_WORKER_POOL_TIMEOUT, TimeUnit.MILLISECONDS);
+
try {
dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED,
connPoolCompaction);
- stmt = dbConn.createStatement();
- String query = "SELECT \"CQ_ID\", \"CQ_DATABASE\", \"CQ_TABLE\",
\"CQ_PARTITION\", " +
- "\"CQ_TYPE\", \"CQ_TBLPROPERTIES\" FROM \"COMPACTION_QUEUE\" WHERE
\"CQ_STATE\" = '" + INITIATED_STATE + "'";
+ StringBuilder sb = new StringBuilder();
+ sb.append("SELECT \"CQ_ID\", \"CQ_DATABASE\", \"CQ_TABLE\",
\"CQ_PARTITION\", " +
+ "\"CQ_TYPE\", \"CQ_POOL_NAME\", \"CQ_TBLPROPERTIES\" FROM
\"COMPACTION_QUEUE\" WHERE \"CQ_STATE\" = '" + INITIATED_STATE + "' AND ");
+ boolean hasPoolName =
org.apache.commons.lang3.StringUtils.isNotBlank(rqst.getPoolName());
Review Comment:
Unfortunately not.
`org.apache.hadoop.util.StringUtils` is already imported, and used 23 times.
It has the `stringifyException(e)` method, which
org.apache.commons.lang3.StringUtils does not contain. On the other side, it
doesn't have any methods for string emptiness check. Since both classes are
required, I decided to fully qualify the lang3 one, since it is used fewer
times.
--
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]