hsyuan commented on a change in pull request #2065:
URL: https://github.com/apache/calcite/pull/2065#discussion_r456685038
##########
File path: core/src/main/java/org/apache/calcite/sql/SqlOperator.java
##########
@@ -929,6 +929,17 @@ public boolean isDeterministic() {
return true;
}
+ /**
+ * Returns whether a call to this operator is not sensitive to the operands
input order.
+ * An operator is symmetrical if the call returns the same result when
+ * the operands are shuffled.
+ *
+ * <p>By default, returns true for {@link SqlKind#SYMMETRICAL}.
+ */
+ public boolean isSymmetrical() {
+ return SqlKind.SYMMETRICAL.contains(kind);
Review comment:
Well, if you think the meaning the method name `isSymmetrical` conveys
is crystal clear and without any ambiguity...
It has several meanings:
- The one you mentioned above, input order insensitive (forgive my ignorance)
- https://www.thefreedictionary.com/Symetrical or
https://en.wikipedia.org/wiki/Symmetry_(geometry)
- [Symmetric
encryption](https://en.wikipedia.org/wiki/Symmetric-key_algorithm) uses it to
denote encryption and decryption use the same key
I do believe there is a reason Scala renamed `symmetricHash` to
`unorderedHash`,
[Cockroachdb](https://github.com/cockroachdb/cockroach/blob/a6a58f4bd1d6b9a7d9f0de2c690d35b51d4f41ca/pkg/sql/opt/optbuilder/groupby.go#L250)
call the method `isOrderingSensitive` instead of others.
For those who lacks of mathematical background, I don't think it is a good
naming public API, which is not self explanatory.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]