Akshat-Jain commented on code in PR #16729:
URL: https://github.com/apache/druid/pull/16729#discussion_r1675938927
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessor.java:
##########
@@ -484,37 +482,36 @@ private void convertRowFrameToRowsAndColumns(Frame frame)
frameRowsAndCols.add(ldrc);
}
- private List<Integer> findPartitionColumns(RowSignature rowSignature)
- {
- List<Integer> indexList = new ArrayList<>();
- for (OperatorFactory of : operatorFactoryList) {
- if (of instanceof NaivePartitioningOperatorFactory) {
- for (String s : ((NaivePartitioningOperatorFactory)
of).getPartitionColumns()) {
- indexList.add(rowSignature.indexOf(s));
- }
- }
- }
- return indexList;
- }
-
/**
- *
- * Compare two rows based only the columns in the partitionIndices
- * In case the parition indices is empty or null compare entire row
- *
+ * Compare two rows based on the columns in partitionColumnNames.
+ * If the partitionColumnNames is empty or null, compare entire row.
+ * <p>
+ * For example, say:
+ * <ul>
+ * <li>partitionColumnNames = ["d1", "d2"]</li>
+ * <li>frameReader's row signature = {d1:STRING, d2:STRING, p0:STRING}</li>
+ * <li>frameReader.signature.indexOf("d1") = 0</li>
+ * <li>frameReader.signature.indexOf("d2") = 1</li>
+ * <li>row1 = [d1_row1, d2_row1, p0_row1]</li>
+ * <li>row2 = [d1_row2, d2_row2, p0_row2]</li>
+ * </ul>
+ * <p>
+ * Then this method will return true if d1_row1==d1_row2 &&
d2_row1==d2_row2, false otherwise.
+ * Returning true would indicate that these 2 rows can be put into the same
partition for window function processing.
*/
- private boolean comparePartitionKeys(ResultRow row1, ResultRow row2,
List<Integer> partitionIndices)
+ private boolean comparePartitionKeys(ResultRow row1, ResultRow row2,
List<String> partitionColumnNames)
Review Comment:
`arePartitionKeysSameForRows()` maybe? Not sure.
This was an existing method naming so didn't think too much about this. I
don't mind the current naming as well though.
--
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]