stoty commented on code in PR #1586:
URL: https://github.com/apache/phoenix/pull/1586#discussion_r1172165997
##########
phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java:
##########
@@ -604,24 +604,19 @@ private long getMaxRebuildAsyncDate(String schemaName,
List<String> disableIndex
if (disableIndexes == null || disableIndexes.isEmpty()) {
return 0;
}
- List<String> quotedIndexes = new
ArrayList<String>(disableIndexes.size());
- for (String index : disableIndexes) {
- quotedIndexes.add("'" + index + "'");
- }
-
String query = String.format("SELECT MAX(" +
ASYNC_REBUILD_TIMESTAMP + "), "
+ "MAX(" + INDEX_DISABLE_TIMESTAMP + ") FROM "
+ SYSTEM_CATALOG_NAME + " (" + ASYNC_REBUILD_TIMESTAMP
+ " BIGINT) WHERE " + TABLE_SCHEM + " %s AND " +
TABLE_NAME + " IN ( %s )",
(schemaName != null && schemaName.length() > 0) ? " =
? " : " IS NULL ",
- QueryUtil.generateInListParams(quotedIndexes.size()));
+ QueryUtil.generateInListParams(disableIndexes.size()));
try (PreparedStatement selSyscat =
connection.prepareStatement(query)) {
int param = 0;
if (schemaName != null && schemaName.length() > 0) {
selSyscat.setString(++param, schemaName);
}
- for (int i = 0; i < quotedIndexes.size(); i++) {
- selSyscat.setString(++param, quotedIndexes.get(i));
+ for (int i = 0; i < disableIndexes.size(); i++) {
Review Comment:
While this works, it would be much cleaner if we pushed this whole for loop
into the utility function.
--
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]