siddharthteotia commented on code in PR #15350: URL: https://github.com/apache/pinot/pull/15350#discussion_r2059656357
########## pinot-core/src/main/java/org/apache/pinot/core/operator/combine/merger/SelectionOnlyResultsBlockMerger.java: ########## @@ -46,15 +50,42 @@ public void mergeResultsBlocks(SelectionResultsBlock mergedBlock, SelectionResul DataSchema mergedDataSchema = mergedBlock.getDataSchema(); DataSchema dataSchemaToMerge = blockToMerge.getDataSchema(); assert mergedDataSchema != null && dataSchemaToMerge != null; - if (!mergedDataSchema.equals(dataSchemaToMerge)) { - String errorMessage = - String.format("Data schema mismatch between merged block: %s and block to merge: %s, drop block to merge", + QueryContext mergedQueryContext = mergedBlock.getQueryContext(); + if (!mergedDataSchema.equals(dataSchemaToMerge) && mergedQueryContext != null + && mergedQueryContext.isSelectStarQuery()) { + Map<String, Integer> mergedBlockIndexMap = mergedDataSchema.getColumnNameToIndexMap(); + Map<String, Integer> blockToMergeIndexMap = dataSchemaToMerge.getColumnNameToIndexMap(); + + List<String> commonColumns = mergedBlockIndexMap.keySet().stream().filter(blockToMergeIndexMap::containsKey) + .collect(Collectors.toList()); + + if (commonColumns.isEmpty()) { + String errorMessage = String.format("No common columns to merge between merged block:" + + " %s and block to merge: %s", mergedDataSchema, dataSchemaToMerge); + LOGGER.debug(errorMessage); + mergedBlock.addErrorMessage(QueryErrorMessage.safeMsg(QueryErrorCode.MERGE_RESPONSE, errorMessage)); Review Comment: When will this happen ? -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org