deniskuzZ commented on code in PR #5883: URL: https://github.com/apache/hive/pull/5883#discussion_r2159986185
########## standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DirectSqlUpdatePart.java: ########## @@ -892,18 +892,25 @@ public List<Void> run(List<Long> input) throws Exception { sdIdToNewCdId.containsKey(sdId) ? sdIdToNewCdId.get(sdId) : cdId); updateSDInBatch(validSdIds, idToSd, sdIdToCdId); - List<Long> usedIds = Batchable.runBatched(maxBatchSize, cdIdsMayDelete, + Set<Long> usedIds = new HashSet<>(Batchable.runBatched(maxBatchSize, cdIdsMayDelete, new Batchable<Long, Long>() { @Override public List<Long> run(List<Long> input) throws Exception { String idLists = MetaStoreDirectSql.getIdListForIn(input); - String queryText = "select \"CD_ID\" from \"SDS\" where \"CD_ID\" in ( " + idLists + ")"; + String queryText = "select \"CD_ID\" from \"SDS\" where \"CD_ID\" in ( " + + idLists + ") group by \"CD_ID\""; + List<Long> cdIds = new ArrayList<>(); try (QueryWrapper query = new QueryWrapper(pm.newQuery("javax.jdo.query.SQL", queryText))) { - List<Long> sqlResult = executeWithArray(query.getInnerQuery(), null, queryText); - return new ArrayList<>(sqlResult); + List<Object> sqlResult = executeWithArray(query.getInnerQuery(), null, queryText); + if (sqlResult != null) { Review Comment: Can it be null? Can we move `cdIds` initialization here? -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org